We're seeing the same problems after upgrading EPiServer.Logging.Log4Net from 2.2.0 to 2.2.1. Downgrading to 2.2.0 made logging work again. The bug is reported to Episerver.
If your code is using this
You may be suffering from https://world.episerver.com/support/Bug-list/bug/CMS-9555
Yeah, but seems that the issue is still there since we are running the version that the bug says it was fixed in.
And changing all our using does not seem like a solution
Hi, we had the same issue. In our case this was caused by the fact there were calls in the initialization modules to log4net LogManager.GetLogger(your-type-here); This was done before episerver had configured log4net (calls to get loggers before any calls to EPiServer.Logging.Log4Net assembly which has the configuration attribute).
Quick fix without any code changes to initialization modules is to just apply the log4net configuration attribute to your web app assembly:
[assembly: XmlConfigurator(ConfigFile = "episerverlog.config", Watch = true)]
The real fix naturally is to stop using log4net directly but using the Episerver logging abstraction, namespace EPiServer.Logging and the LogManager there.
You should only use the EPiServer.Logging.Compatibility to "quickly" change direct calls to log4net instead to Episerver abstraction.
Same issue here. No loggers in any initialization modules what so ever and not using of log4net namespace. Logging just stopped working. Downgraded to 2.2.0 and it started to work again.
Hah, I had just tested the logging in local development in debug mode where it works. Checked our internal test - oooops no logs.
Reflector shows that Episerver has added a PreApplicationStartModule.PreApplicationStart() static method which calls log4net.LogManager(typeof(PreApplicationStartModule)); there goes the log4net configuration in release mode.
Here is the work around to have logging working again with 2.2.1:
<appSettings> <!-- add these entries to configure log4net --> <add key="log4net.Config" value="EPiServerLog.config"/> <add key="log4net.Config.Watch" value="True"/> </appSettings>
We have now figured out what caused this issue. The overload to GetLogger in log4net that was used from EPiServer.Logging.Log4Net called Assembly.GetCallingAssembly() and in released compiled code this was evaluated to mscorlib.
Reason for this is optimizations done by the compiler when doing release compilation.
We will try to get a fix out as soon as possible.
So the takeaway is be careful when using Assembly.GetCallingAssembly(), it might be different than expected due to compiler optimizations.
Awesome! Hope you can get it out real soon.
A new version of EPiServer.Logging.Log4Net is now released and available in the NuGet feed.
As Åsa says, this is now available
We upgraded from episerver 10 -> 11 (the release that came out 5 february) and logging for us stopped working. After a lot of investigating we are seeing that our appenders from EPIServerLog.config is not beeing loaded. When we add these lines at the top of our InitializationModule we can get it to work. But this is not the solution ofc, does someone know what has happend?