Serilog 2.3 and enqueued jobs

I have a job that is enqueued that uses serilog to log and after some random number of jobs will stop stop logging. I will requeue those jobs and it will randomly stop logging on a different job that previously logged. When it does fail its at random points.

I have a scheduled job using serilog that logs just fine.

There are no errors in the hangfire log which is using nlog.

The jobs continue to run and the results are correct.

I’m using the appsettingsconfig sink.

Log.Logger = new LoggerConfiguration()
            .ReadFrom.AppSettings(settingPrefix: "MyJob")

I have no idea what to do or where to look.

Please help!

It does the same thing if I just have an object log. It works for a random few and then stops logging.

  public class Logging
        public Logging()
            // Configure logging sinks
            Log.Logger = new LoggerConfiguration()
                .ReadFrom.AppSettings(settingPrefix: "LoggingTest")
                .CreateLogger(); //.ForContext<Logging>();

        public void LogSomething(string something)
            Log.Information("Log: {0}", something);


Looks like its because serilog is static and shared in the hangfire app domain and each job was hijacking the logger resetting the file path.

Switch back to nlog.