Hangfire 1.3.0 Released

10 Dec 2014 edit on github

Logging that just works

Logging was a very difficult thing to set-up in previous versions of Hangfire. Even if we omit tricky versioning issues, you had to install a separate logging adapter for your current logging library, with guessing the right one first (i.e. Common.Logging.NLog or Common.Logging.NLog20).

Now, the logging just works. If your project already uses Elmah, NLog, Log4Net, EntLib Logging, Serilog or Loupe you are not required to do anything. Thanks to awesome LibLog library by Damian Hickey (@randompunter on Twitter), installed logging library will be used automatically through the reflection.

If your application uses other logging library or a custom one, just implement two simple interfaces:

public interface ILog
    bool Log(LogLevel logLevel, Func<string> messageFunc, 
        Exception exception);

public interface ILogProvider
    ILog GetLogger(string name);

And yes, Hangfire is no more have Common.Logging or Common.Logging.Core dependencies.

Debugging with Symbolsource

SymbolSource is a service which exposes PDB symbols so you can step through Hangfire code while debugging your application. There are a few things to configure before we can begin, see symbolsource.org for more information.

Within Visual Studio:

  1. Go to Tools → Options → Debugger → General
  2. Uncheck “Enable Just My Code (Managed only)”
  3. Uncheck “Enable .NET Framework source stepping”
  4. Check “Enable source server support”
  5. Uncheck “Require source files to exactly match the original version”
  6. Go to Tools → Options → Debugger → Symbols
  7. Select a folder for the local symbol/source cache
  8. Add symbol servers under “Symbol file (.pdb) locations”: http://srv.symbolsource.org/pdb/Public

To speed up startup of the debug session, you can specify only the Hangfire dlls to be loaded. Go to Tools → Options → Debugger → Symbols, select "Only specified modules" and enter Hangfire.*.dll

Now you can step into Hangfire code while debugging.