Since Episerver was updated to version 11, there has been an issue with Log4net logging on custom classes. Although this has already been reported, there has not been an official patch released in order to fix this issue. However, there is a common way to fix this.
First, we will need to change the namespace we’re importing and use “EPiServer.Logging.Compatibility” instead of the commonly used “log4net”. After that we will create an instance of the logger like this:
private readonly ILog _logger = LogManager.GetLogger(typeof(FormsController));
The only thing left to do would be to set a route to the log4net configuration file inside the web.config in the <appSettings> section like this:
<add key="log4net.Config" value="EPiServerLog.config"/> <add key="log4net.Config.Watch" value="True"/>
- Initialization module using log4net directly disables logging [Episerver Developer Community Support]
- Upgrade to CMS 11 - Log4Net stopped working [Episerver Support Center]
- Logging with log4net [Developer Community Documentation]