I published a basic asp.net core app to Azure experimenting with Serilog but it gives me a 500 error after publishing. When I comment out the RollingFile Sink it publishes fine without error. Any reason why this might be happening? Also it works fine on my local machine.
public Startup(IHostingEnvironment appEnv)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
//.WriteTo.RollingFile(Path.Combine(appEnv.WebRootPath, "log-{Date}.txt"), retainedFileCountLimit: 5)
.CreateLogger();
}
It's possible for
env.WebRootPath
to benull
. In that case,Path.Combine()
will (AFAIK) throw anArgumentNullException
, which would account for the 500 errors.