The log4net assembly (version 1.2.10) has been added to all editions of the DotNetNuke framework in 6.0.
Log File Details:
- Location: Portals\_default\Logs
- Naming convention: yyyy.MM.dd.log.resources
- Each file is limited to 10MB in size
- Maximum of 5 files (50MB total in size)
The configuration of log4net is controlled by the DotNetNuke.log4net.config file in the root of the website. The default configuration can be seen below:
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="Portals/_default/Logs/" />
<datePattern value="yyyy.MM.dd'.log.resources'" />
<rollingStyle value="Date" />
<staticLogFileName value="false" />
<appendToFile value="true" />
<maximumFileSize value="10MB" />
<maxSizeRollBackups value="5" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%property{log4net:HostName}][Thread:%thread][%level] %logger - %message%newline" />
<locationInfo value="true" />
</layout>
</appender>
<root>
<level value="ERROR" />
<appender-ref ref="RollingFile" />
</root>
</log4net>
When attempting to diagnose site errors, you may want to consider changing the logging level. Log4net supports the following logging levels:
- ALL
- DEBUG
- INFO
- WARN
- ERROR
- FATAL
- OFF
To see all logged actions during install/upgrade/portal operation, consider changing it as follows:
<level value="ALL" />
Alternative appenders
Log4net supports the concept of appenders, allowing logged items to go to alternative (and multiple) endpoints. Appenders can be set up with different configurations allowing different levels to go to different appenders e.g. perhaps a site might send FATAL messages to a pager appender, ERROR messages to an email appender and all other levels to a rolling text file.
Log4net support
appenders to all the obvious areas such as windows event logs, console, a database, file system etc, as well as supporting writing your own custom appenders.
An example of an alternative appender is below where messages get transmitted via UDP, allowing tools such as
log4view (which supports 1 appender in it's free version) to consume and display those messages.
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
<param name="RemoteAddress" value="127.0.0.1" />
<param name="RemotePort" value="20480" />
<layout type="log4net.Layout.XmlLayout">
<locationInfo value="true" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="UdpAppender" />
</root>
</log4net>
7.3.0 enhancement
The existing
log4net capability was
enhanced to support logging of "processid" and "appdomain" for diagnosing hard to reproduce issues.
Additional references