Try our conversational search powered by Generative AI!

Logger location is wrong when using logger extensions

Found in

EPiServer.Logging.Log4Net 1.0.0

Created

May 21, 2015

Updated

Oct 01, 2015

Area

Falcon/CMS/Core

State

Closed, Fixed and Tested


Steps to reproduce

The location of the logger is wrong when logging using LoggerExtensions or the Compatibility layer.

Instead of the expected type and method from where the log method was called, the location is always  "EPiServer.Logging.LoggerExtensions.Log".

 

This problem is only present if you use %location or %l in the log4net layout pattern.

 

Workaround: Change %location to %logger. This displays the logger name, which is usually the name of the class where it's used.

Note that log4net documentation recommended against using location in the layout pattern for performance reasons, as it can be "extremely slow". This fix creates a breaking change.