Apache Logging Service and Log4Net

Log4net is a popular open source framework of the Apache Logging Project to log application errors for web sites.

Log4net is part of the Apache Logging Services project at the Apache Software Foundation. The Logging Services project is intended to provide cross-language logging services for purposes of application debugging and auditing.

The Apache log4net project

DotNetNuke and Evoq

Starting with DNN v6 the log4net package was added. It was enhanced in DNN v7.3 to support “processid” and “appdomain”.

You can access its configuration file directly or under the admin Gear Icon > Settings > Configuration Manager and then under the “Config Files” tab. You will need to be a superuser to access it.

Basic details

Log File:

  • 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)
  • Can be delete once the system releases the file

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>

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

DNN’s Log4net fully supports the concept of appenders, allowing logged items to go to alternative (and multiple) endpoints.

For examples see the Log4net appenders support page. You can writing your own custom appenders too.

Troubleshooting

Known Issues

Logfiles to not get deleted or size not limited

There is a known bug in DNN v7 before it was fixed in DNN 7.4.2, but this bug has appeared in other versions.

  • Remove old log files.
  • This bug can affect performance.

Reference

Did you get a clue?

If you got a clue and want to thank me, then visit the thank me page. It’s the best way to keep me publishing articles and keeping this site operation.

This site uses affiliate links. When you go to another site from here the link typically will have an affiliate code attached to it. Your actions on that site may earn a small commission for me. Read our affiliate link policy for more details.

{fin}

Scroll to Top