-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Colors are always suppressed when a console is redirected #50
Comments
May be a little late for me to chime in, but thanks for the note @atruskie! I think it's a reasonable expectation we'd do this separately per output stream, but I can't see a clean way to bake the functionality in quickly - some thought would need to go into how to restructure things. |
I believe I am running into this as well. I am listening to logs from Kubernetes pod running .NET Core 3.1. Whatever value I set for the "Serilog": {
"Using": [
"Serilog.Sinks.Console"
],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"theme": "Serilog.Sinks.SystemConsole.Themes.SystemConsoleTheme::Literate, Serilog.Sinks.Console",
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} <s:{SourceContext}>{NewLine}{Exception}"
}
}
], |
I am using the Kubernetes Dashboard to view logs. I have updated to {
"Serilog": {
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Level:u3}]({RequestId}) {Message:lj}{NewLine}{Exception}",
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Literate, Serilog.Sinks.Console",
"applyThemeToRedirectedOutput": true
}
}
],
"MinimumLevel": {
"Default": "Information",
"Override": {
"System": "Information",
"Microsoft": "Information",
"Microsoft.EntityFrameworkCore.Database.Command": "Warning"
}
}
}
} I am not seeing any colors yet. Thanks for your help. |
FYI using 4.0.0-dev-00839 I have the coloured console output working on AKS with the following confguration in appsettings.json; ...
"WriteTo": [
{
"Name": "Console",
"Args": {
"theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console",
"applyThemeToRedirectedOutput": true
}
}
],
... |
Closing as stale. |
A few questions before you begin:
Does this issue relate to a new feature or an existing bug?
What version of Serilog Console Sink is affected by this issue? Please list the related NuGet package.
3.1.2-dev-00779
What is the target framework and operating system affected by this issue? Please see target frameworks & net standard matrix.
Please describe the current behaviour you are experiencing?
When running my .NET Core console application colors are suppressed when the streams are redirected.
More importantly, colors in both streams are suppressed even if only one stream is redirected.
E.g.:
MyApp.exe > test.txt
redirects stdout (but not stderr) and removes all color from both stdout and stderr.Please describe the expected behaviour if the ?
Some context: my stdout stream produces data that is usually captured via redirection. Hence I send all logs to stderr and I'd like them to always look the same - whether or not someone is capturing stdout.
If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem
My configuration:
And the line in the configuration extension that causes this beaviour:
serilog-sinks-console/src/Serilog.Sinks.Console/ConsoleLoggerConfigurationExtensions.cs
Lines 60 to 62 in f1dc616
The text was updated successfully, but these errors were encountered: