<< Click to Display Table of Contents >> Navigation: Enterprise > Configuration > Enabling Enterprise Logging > Error Logging – Enable Rolling Log File on the Application Server |
The EQuIS Enterprise log4net.config is configured for the AdoNetAppender enabled with logging level set to "Off." The AdoNetAppender allows for direct logging into the EQuIS database (to ST_LOG). However, Log4net can be configured to log to a text file on the application server (RollingLogFileAppender).
To enable the RollingLogFileAppender, the log files will typically be stored in C:\Windows\Temp\equislogs.
The log4net.config file is located in the \Enterprise7\bin\ directory and is the configuration file for the log4net logging application.
Setting |
Line Numbers |
Notes |
Log File Location |
Line 12 |
Default Value (system temp): <file type="log4net.Util.PatternString" value="%env{temp}/equislogs/{baseUri}/{process} .log" /> |
Max Amount of Log Files |
Line 14 |
Default Value (10 files): <param name="MaxSizeRollBackups" value="10" /> |
Log File Size |
Line 15 |
Default Value (500KB): <param name="MaximumFileSize" value="500KB" /> |
Logging Level |
Line 97 |
Default Value (off): <level value="error" /> Available Values: off, error, warn, debug, all |
To enable logging to a text file only on the server, RollingLogFileAppender will need to be uncommented and the AdoNetAppender will need to be commented out.
To enable the RollingLogFileAppender, uncomment lines 11-22 and line 98 (approximately). Comment out lines 37-79 and line 100 (approximately).
Note: IIS will need to be restarted after setting the logging or modifying the log4net.config file. |
An example of the log4net.config file with only the RollingLogFileAppender enabled (and the AdoNetAppender disabled) can be seen below:
<?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>
<logger name="EarthSoft.Server.Helpers.DeviceToken">
<level value="off" />
</logger>
<logger name="EarthSoft.Server.Helpers.SessionToken">
<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="all" />
<appender-ref ref="RollingLogFileAppender" />
<!--<appender-ref ref="ConsoleAppender"/>-->
<!--<appender-ref ref="AdoNetAppender"/>-->
</root>
</log4net>
Visit http://logging.apache.org/log4net/ for more information on log4net.
Copyright © 2024 EarthSoft, Inc. • Modified: 17 Aug 2020