Reputation: 2862
I have an Net Core Web API hosted in an Azure App Service and I am trying to format the output of the Azure Log Stream in the same way the Console is formatted in my Development environment.
I am using NLog for this and I am redirecting all logs to the Console using the NLog ColoredConsole:
"target": {
"type": "ColoredConsole",
"layout": "${var_layout}",
"rowHighlightingRules": [
{
"condition": "level == LogLevel.Trace",
"foregroundColor": "DarkGray"
},
{
"condition": "level == LogLevel.Debug",
"foregroundColor": "DarkGray"
},
{
"condition": "level == LogLevel.Warning",
"foregroundColor": "Yellow"
},
{
"condition": "level == LogLevel.Error",
"foregroundColor": "Red"
},
{
"condition": "level == LogLevel.Fatal",
"foregroundColor": "Yellow",
"backgroundColor": "Red"
}
]
}
In my Startup.cs I removed AddConsole()
option and I configured NLog to send all formatted output to the ColoredConsole.
This works well on my local Console and everything is formatted as expected.
However in the Azure Log Stream I can still see the default formatting (all white on black background) and layout (my custom logged data with NLog is missing).
My question is: why the Azure Log Stream is not showing the formatted output? Is that not showing exactly what the Console is logging?
If not, how can I format the Azure Log Stream output?
Upvotes: 1
Views: 685
Reputation: 3398
I'm afraid your need is not supported on Azure.
The Log Stream just output the console message, but not a real console, so it would be a bit tricky with colors.
Just like the link Rolf Kristensen post, there is no solution about colored console with any Azure Log system.
Upvotes: 2