I try to make serilog working with my app executed via supervisord - unfortunately, it does not work so far.
I made a couple of tests and was able to isolate the problem. Both of commands below were executed on root account.
Does not log to file
su -s /bin/bash -c "cd /home/user/test/; dotnet test.dll" - root
Works (text is written to a log file and console)
dotnet test.dll
The tests were performed on CentOS with SELinux turned off. The configuration in appsettings.json is the same.
Any suggestions on what else can I test?
So it turned out that environment variable was not set.
In supervisor config I was missing
environment=ASPNETCORE_ENVIRONMENT=Production