Log4net, howto?

Tags: #<Tag:0x00007faffc57ddf8>

Hello.
I have installed log4net and configured 1 appender named “ConsoleAppender”.
Now when i try to start my application, all I get is this:

Exception occured resolving a log provider. Logging for this assembly Hangfire.Core, Version=1.6.12.0, Culture=neutral, PublicKeyToken=null is disabled. System.ArgumentNullException: Value cannot be null.
Parameter name: method
   at System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method, Expression arg0)
   at System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method, IEnumerable`1 arguments)
   at Hangfire.Logging.LogProviders.Log4NetLogProvider.GetGetLoggerMethodCall()
   at Hangfire.Logging.LogProviders.Log4NetLogProvider..ctor()
   at Hangfire.Logging.LogProvider.<>c.<.cctor>b__10_2()
   at Hangfire.Logging.LogProvider.ResolveLogProvider()

According to this url, everything should just work?
http://docs.hangfire.io/en/latest/configuration/configuring-logging.html

Do I need to add some sort of LOG4NET config to my XML in order to get this to work?

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
  <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender" >
<file value="App_Data/Logs/Logs.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
  <conversionPattern value="%-5level %date [%-5.5thread] %-40.40logger - %message%newline" />
</layout>
  </appender>
  <root>
<appender-ref ref="RollingFileAppender" />
<level value="ALL" />
  </root>
</log4net>

I have same problem using those config. Log4net works on application but got error on hangfire.
My application run on .net core 1.1. I have no idea how to get rid the problem.

Hello, did you ever figure out the issue you were having? I am using .net core also.

Edit: Did some more digging and found this issue for liblog: https://github.com/damianh/LibLog/issues/126

Might need to switch to a different logger.

I had to do a workaround, I used this method to manually add a logger:
LogProvider.SetCurrentLogProvider(new HangfireLoggerProvider());

And since I nwver understood what class to use, I had to implement my own:

    public class HangfireLoggerProvider : ILogProvider
    {
        public ILog GetLogger(string name)
        {
            return new HangefireLogger(name);
        }

        public class HangefireLogger : ILog
        {
            private readonly log4net.ILog _log4Netlogger;

            public HangefireLogger(string name)
            {
                _log4Netlogger = log4net.LogManager.GetLogger("Hangfire", name);
            }

            public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception)
            {
             ....
           }
}