log4net.config

<< Click to Display Table of Contents >>

EQuIS 7  >>  Configuration > App Config Files >

log4net.config

The Apache log4net library is a tool to help the programmer output log statements to a variety of output targets. log4net is a port of the excellent Apache log4j™ framework to the Microsoft® .NET runtime.

https://logging.apache.org/log4net/license.html

 

EQuIS uses Log4net for debug logging. Prior to EQuIS 6.5, the preferred appender was the RollingLogFileAppender. While still useful to troubleshooting database connectivity issues it places a significant performance tax on the EQuIS Enterprise application. Additionally, altering the log configuration required remote access to the application server to modify this file.  EQuIS 6.5 introduces the ability to manage logging through the st_config table. This is the only option when hosting EQuIS Enterprise in Microsoft Azure. EarthSoft recommends leaving the AdoNetAppender configured as is and using the st_config setting to manage error logging.

 

Please note that the connectionString value {ConnectionString} will be replaced with the current connection string at run time. There is no need to provide a connection string unless the aim is to log to a different database.

 

 

<?xml version="1.0" encoding="utf-8" ?>

<log4net>

  <!-- 

                 This section defines the "appenders" used to store log messages.

           Other appenders are available (TraceContext, database, Event Log, SMTP, etc.). 

                 For more information, see:

                         http://logging.apache.org/log4net/release/config-examples.html

         -->

  

  <!--

  <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">

    <file type="log4net.Util.PatternString" value="%env{temp}/equislogs/{baseUri}/{process}.log" />

    <param name="AppendToFile" value="true" />

    <param name="MaxSizeRollBackups" value="10" />

    <param name="MaximumFileSize" value="500KB" />

    <param name="RollingStyle" value="Size" />

    <param name="StaticLogFileName" value="true" />

    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />

    <layout type="log4net.Layout.PatternLayout">

      <param name="ConversionPattern" value="%d %property{url} %property{ip} [%t] %-5p %c [%x] - %m%n" />

    </layout>

  </appender>

  -->

  

  <!--

  <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">

    <layout type="log4net.Layout.PatternLayout">

      <param name="ConversionPattern" value="%d  %property{url} %property{ip} [%t] %-5p %c [%x] - %m%n"/>

    </layout>

  </appender>

  -->

 

  <!-- For Oracle: 

                                 - Change the connectionType from 'System.Data.SqlClient.SqlConnection' to 'System.Data.OracleClient.OracleConnection' and 'System.Data.SqlClient' to 'System.Data.OracleClient'

                                 - Change the '@' to ':' in the command text and paramaterName values.

         -->

    <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">

    <bufferSize value="1" />

    <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

    <connectionString value="{ConnectionString}" />

    <commandText value="INSERT INTO st_log (log_date,log_thread,log_level,logger,message, log_trace) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)" />

    <parameter>

      <parameterName value="@log_date" />

      <dbType value="DateTime" />

      <layout type="log4net.Layout.PatternLayout" value="%date{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />

    </parameter>

    <parameter>

      <parameterName value="@thread" />

      <dbType value="String" />

      <size value="255" />

      <layout type="log4net.Layout.PatternLayout" value="%thread" />

    </parameter>

    <parameter>

      <parameterName value="@log_level" />

      <dbType value="String" />

      <size value="50" />

      <layout type="log4net.Layout.PatternLayout" value="%level" />

    </parameter>

    <parameter>

      <parameterName value="@logger" />

      <dbType value="String" />

      <size value="255" />

      <layout type="log4net.Layout.PatternLayout" value="%logger" />

    </parameter>

    <parameter>

      <parameterName value="@message" />

      <dbType value="String" />

      <size value="4000" />

      <layout type="log4net.Layout.PatternLayout">

        <param name="ConversionPattern" value="%message (%property{url} %property{ip} %property{culture})" />

      </layout>

    </parameter>

    <parameter>

      <parameterName value="@exception" />

      <dbType value="String" />

      <size value="4000" />

      <layout type="log4net.Layout.ExceptionLayout" />

    </parameter>

  </appender>

 

  <!-- logger(s) disabled by default -->

  <logger name="EarthSoft.Common.Helpers.AssemblyHelper">

    <level value="off" />

  </logger>

 

  <!-- what level of logging do you want to use:

      warn: only logs errors and warnings

      all: logs errors, warnings, and information messages (uses more disk space)

    -->

  <root>

    <level value="off" />

    <!--<appender-ref ref="RollingLogFileAppender" />-->

    <!--<appender-ref ref="ConsoleAppender"/>-->

    <appender-ref ref="AdoNetAppender"/>

  </root>

</log4net>