You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When starting this I would expect all the messages appearing in Filename.log, but the "Starting" message appears in the Console. Everything else appears in the file as expected.
Why doesn't the "Starting" message appear in the log file, and what can I do to have everything appear in the file? (and everything logged to console if something fails)
The text was updated successfully, but these errors were encountered:
Hi @gthvidsten; at the point Log.Information("Starting") is called, the bootstrap logger hasn't been reconfigured to write to the file, yet.
If you can move everything to the initial LoggerConfiguration (and customize the file path using environment variables, perhaps?) you can get around this:
Thanks for the reply.
I really don't want to have to read configurations this soon in the startup, but I see I might have been mistaken about how the BootstrapLogger is working:
I thought that it would create a logger, but not log anything to it until .AddSerilog() had been properly called, so that any messages logged before this would be cached and written to the correct place when it was available, and writing to the defaults only happens if something went wrong.
For now I may just remove the "Starting" message alltogether, though I'm open to other suggestions, of course :)
I'm following the example and have the following code:
And this
appsettings.json
:Using the following packages:
When starting this I would expect all the messages appearing in
Filename.log
, but the "Starting" message appears in the Console. Everything else appears in the file as expected.Why doesn't the "Starting" message appear in the log file, and what can I do to have everything appear in the file? (and everything logged to console if something fails)
The text was updated successfully, but these errors were encountered: