Search code examples
asp.net-mvclog4nethangfire

How to set LogLevel to error in log4net for hangfire


We have a web application and we are using log4net for logging. Recently I installed hangfire and now my log table (sqlserver db) is full of log enteries from hangfire. I want to minimise this to error and exceptions only. I believe I can set it by setting LogLevel to error but where exactly I need to do that.

Thanks


Solution

  • Add this logger to your web.config (log4net section)

    <logger additivity="false" name="Hangfire">
       <level value="ERROR" />
       <appender-ref ref="HangfireLoggerAppender" />
    </logger>