The Issue
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.
The Fix
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:
logging instance
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:
web.config
<add key="log4net.Config" value="EPiServerLog.config"/>
<add key="log4net.Config.Watch" value="True"/>
References