I have an Azure Function that runs every half hour. I have set the log configuration to redirect to the console.
Configuration.Default.Logger.Level =
PureCloudPlatform.Client.V2.Client.LogLevel.LTrace;
Configuration.Default.Logger.Format = LogFormat.JSON;
Configuration.Default.Logger.LogRequestBody = true;
Configuration.Default.Logger.LogResponseBody = true;
Configuration.Default.Logger.LogToConsole = true;
Configuration.Default.Logger.LogFilePath = tempFolder+"\dotnetsdk.log";
I can see in the console that "Inin-Correlation-Id" is being logged. However, I cannot get access to this from within the code. I redirect the output to a log file but I cannot read this log file from the code as it is always in use.
How do I get access to the information logged to the console from within the code?
2
Answers
I create a new logger class
and then in the function code
Yes, the logged information in the console from can be accessed within the code.
For this you need to do the below things.
Host.Json
file you need to mention "fileLoggingMode": "always".Output