Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
There are two built-in logger factories for writing log messages from the EPiServer Log API to .NET Diagnostics Trace; the EPiServer.Logging.TraceLoggerFactory and the EPiServer.Logging.TraceSourceLoggerFactory.
The EPiServer.Logging.TraceLoggerFactory logger redirects all log messages to diagnostics trace.
You enable the EPiServer.Logging.TraceLoggerFactory like this:
<appSettings>
<add key="episerver:LoggerFactoryType" value="EPiServer.Logging.TraceLoggerFactory" />
</appSettings>
Or from the episerver.framework section like this:
<episerver.framework loggerFactoryType="EPiServer.Logging.TraceLoggerFactory">
The EPiServer.Logging.TraceSourceLoggerFactory redirects all log messages to diagnostics trace source. In this implementation each logger name has its own source switch trace.
You can enable the EPiServer.Logging.TraceSourceLoggerFactory like this:
<appSettings>
<add key="episerver:LoggerFactoryType" value="EPiServer.Logging.TraceSourceLoggerFactory" />
</appSettings>
Or from the episerver.framework section like this:
<episerver.framework loggerFactoryType="EPiServer.Logging.TraceSourceLoggerFactory">
By default, the logging level is set to the Error level. If you need to log lower levels than the Error level you need to configure it in the system.diagnostics section like this:
<system.diagnostics>
<sources>
<source name="logger name" switchName="logger name" switchType="System.Diagnostics.SourceSwitch"/>
</sources>
<switches>
<add name="logger name" value="Verbose" />
</switches>
</system.diagnostics>
To register a logger factory via configuration, you need to add the logger factory type in the appsettings section:
<appSettings>
<add key="episerver:LoggerFactoryType" value="the custom logger factory type" />
</appSettings>
Or from the episerver.framework section:
<episerver.framework loggerFactoryType="the custom logger factory type">
Note: Remember that the appsetting section value always has higher priority to be used than the episerver.framework section value.
Last updated: Jul 14, 2016