Add the option to log to the console
See original GitHub issueAdd the sink to let Serilog log to the console: Serilog.Sinks.Console
. This is especially useful in environments like Kubernetes where you want to do logshipping/distributed logging. It can be off by default, although that would not be my preference.
The recently added logging to the DB is definitely not my preferred way to keep logs. You lose the option to do structured logging as well. I would vote to make this optional as well. I want to be able to do log-shipping to off-site services like Seq/Cloudwatch/Datadog. Currently there is no way to scrape those logs, except from file, but that requires write access to the file-system which in a Docker environment isn’t desirable either. We also need to revisit the current way of logging to enable structured logging so that services like seq and cloudwatch can do structured queries on certain properties. Adding distributed tracing with OpenTracing/Jaeger is certainly another thing we need to take a look at.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
I wouldn’t want to add dependencies that are opinionated and stick to the basics ones. We don’t want to impose any preference but leave open the option to add more by just referencing the sink required and changing the configuration. Actually, I’d leave the console to be the only one enabled. Any other option as logging is a very opinionated topic. As mentioned before even file logging might not be desirable (especially in docker env’s ). Looking at the Provided-Sinks of Serilog, I’d go with just
appsettings.Development.json
)People can then choose/configure their own by adding the reference and updating their
appsettings.json
.We should choose the do logging earlier as well as specified in Serilog’s example to catch EF migration errors, which are not logged to sql at the moment (as it crashes beforehand): https://github.com/serilog/serilog-docker/blob/master/web-sample/src/Program.cs, which should be a straight forward change.
According to @bravecobra PR added into dev.