I'm using logging in dotnetcore 3.1. When I use composite formatting of dates in a logger, I get a different format than if I convert the date to a string in my application code.
This code:
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
_logger = loggerFactory.CreateLogger<Program>();
_logger.LogInformation("TEST date via format string {}", DateTime.Today);
_logger.LogInformation("TEST date with concatentation:" + DateTime.Today);
produces this output (note the change in order of days and months):
TEST date via format string 08/26/2020 00:00:00
TEST date with concatentation:26/08/2020 00:00:00
I'm surprised the logger doesn't inherit the culture from the application. Am I missing something, and if not how can I control the culture of the logger?