Update:
Is it possible to add or change a command that executes a pipeline on Azure DevOps?
Running my program locally on Visual Studio Code, I do get outputs.
However, running my GitHub origin branch on Azure DevOps does not yield any output.
I followed a Stack Overflow answer, which references this solution to a GitHub Issue.
I have implemented the below, but Azure's Raw Logs return blank on my Python logging.
test_logging.py:
import logging
filename = "my.log"
global logger
logger = logging.getLogger()
logger.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
open(filename, "w").close() # empty logs
fileHandler = logging.FileHandler(filename)
fileHandler.setFormatter(formatter)
fileHandler.setLevel(logging.INFO)
logger.addHandler(fileHandler)
logger.error('TEST')
# fetch logs
with open(filename, "r") as fileHandler:
logs = [log.rstrip() for log in fileHandler.readlines()]
open(filename, "w").close() # empty logs
print('logs = ', logs)
>>> logs = []
host.json:
{
"version": "2.0",
"logging": {
"fileLoggingMode": "always",
"logLevel": {
"default": "Debug"
}
}
}
I then tried this alternative host.json from post:
"logging": {
"fileLoggingMode": "debugOnly",
"logLevel": {
"default": "None",
"Host.Results": "Information",
"Function": "Information",
"Host.Aggregator": "Information"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": false,
"maxTelemetryItemsPerSecond": 5
}
}
}
Please let me know if there is anything else I should provide.
from No Logging on Azure DevOps Pipeline
No comments:
Post a Comment