-
Notifications
You must be signed in to change notification settings - Fork 72
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
color themes not appearing in output #64
Comments
Thanks! I think this will be due to the output redirection check here: https://github.com/serilog/serilog-sinks-console/blob/dev/src/Serilog.Sinks.Console/ConsoleLoggerConfigurationExtensions.cs#L60 Perhaps we consider an |
[nods in agreement, hoping to look like someone who understands the ramifications as relate to discoverability...] |
Well, this answers the question I've been banging my head against a wall for several hours trying to solve. |
Any timeline for addressing this? Thx in advance. |
The code involved shouldn't be onerous, it's probably a small change - we're mostly in need of a proposal that works through alternative solutions. My concern with |
Would it make sense to default |
@tjaart the default avoids writing control sequences when piping the output of a command to a file (e.g. |
@nblumhardt I've created a PR. I was unsure about the direction of the change, please feel free to make suggestions. |
@WellspringCS you can try the latest dev version of Serilog and use the
I did notice however that Rancher needs an ANSI Color scheme to show colours in output, so if you are working on that platform you have to force the theme. Log.Logger = new LoggerConfiguration()
.WriteTo.Console(theme: AnsiConsoleTheme.Literate, applyThemeToRedirectedOutput: true)
.CreateLogger(); |
Thank you, will do |
Just had a good opportunity to implement this, but did not see any change. Am I doing something wrong? using (Ubuntu 18.04):
This is what I see... Do I need to change my versions on other Serilog package references for this to work? |
Hi @WellspringCS - no, console should be enough; might need some more investigation. What terminal are you using? (Default in Ubuntu?) Is your app running under Docker or some other orchestrator that manages output? Thanks! |
No orchestration, just VSC running on Ubuntu, output going straight to Debug Console in lower pane. HTH... |
Hi, I'm running on Docker and can replicate both behaviors. @tjaart I didn't try using the dev version you mentioned. |
@WellspringCS have you tried setting |
@thylux did you set the |
@tjaart No. i'm using Serilog.Sinks.Console, Version=3.1.1.0. I don't know enough of docker to know why but that might give you some hint. |
The Documentation for Serilog.Sinks.Console needs to be updated to include the "applyThemeToRedirectOutput" |
@tjaart Thank you so much for this solution. I have spend hours to resolve this issue with a .NET Web API Application running under IIS Express. I tried several things from net5.0 project has no color on console output with dotnet watch run and dotnet watch removes console color but none of the suggestions worked. Setting |
I can't take credit for the solution--only for opening the issue, LOL. Glad the solution offered here (not by me) worked for you, though! |
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.
Linux Ubuntu 18.04
Code for 3.0 shown here, but I replicated it in netcoreapp2.2 as well.
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?
log output has no colorization
Please describe the expected behaviour if the ?
colorization of output, as per description
If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem
brand new project, didn't change Startup.cs
Program.cs:
launch.json:
Notice that the Serilog log item has no color, however the built-in logger output below it does.
The text was updated successfully, but these errors were encountered: