KBEC-00021 - Controlling log files for the ElectricCommander server or agent

Summary

This article describes how to adjust the level of detail and log retention policy for the ElectricCommander server and agent.

Server solution

The ElectricCommander server uses the Log4J logging system. The logging configuration can be changed without restarting the server. Doing so requires finding and editing the log4j.xml file, which is located in one of the following locations:

PlatformCommander versionDefault Location
UNIX 3.0 to 4.0 /opt/electriccloud/electriccommander/conf/log4j.xml
Windows 3.0 to 4.0 C:\Documents and Settings\All Users\Application Data\Electric Cloud\ElectricCommander\conf\log4j.xml
UNIX before 3.0 /opt/electriccloud/electriccommander/server/conf/log4j.xml
Windows before 3.0 C:\Program Files\Electric Cloud\ElectricCommander\server\conf\log4j.xml

Forcing a flush

For performance reasons, the server buffers messages that may result in a lag between message generation and when the message shows up in the log file. You can force the server to flush the buffers immediately by changing the timestamp on the log4j.xml file (for example, 'touch log4j.xml').

Configuring the log rolling policy

The server automatically rolls over to a new log file as its log reaches the maximum size. The server retains a fixed number of old logs, deleting the oldest log whenever it adds a new one. The policy for log file size and retention can be adjusted by editing the log4j.xml file. Look for the following element:


<appender name="FILE"
class="org.apache.log4j.RollingFileAppender">
<param name="Append" value="true" />
<param name="BufferedIO" value="false" />
<param name="Encoding" value="UTF-8" />
<param name="File" value="logs/commander.log" />
<param name="MaxFileSize" value="200MB" />
<param name="MaxBackupIndex" value="10" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%-23d{yyyy-MM-dd'T'HH:mm:ss.SSS} | %-5p | %-13.13t | %-45
.45x | %-30.30c{1} | %m%n" />
</layout>
</appender>

The 'MaxBackupIndex' in this example specifies the server should retain the most recent 10 (default was 50) log files. The 'MaxFileSize' configures the server to roll the log file when it grows to 200 MB (default was 100 MB). This configuration limits the log files size to 2 GB (default was 5 GB).

See also

Agent Solution

The ElectricCommander agent uses the agent.conf file to change the logging system. Find and edit the agent.conf file, which is located in one of the following locations:

PlatformCommander versionDefault Location
UNIX 3.0 to 4.0 /opt/electriccloud/electriccommander/conf/agent.conf
Windows 3.0 to 4.0 C:\Documents and Settings\All Users\Application Data\Electric Cloud\ElectricCommander\conf\agent.conf

Configuring the log rolling policy

The agent automatically rolls over to a new log file as its log reaches the maximum size. The agent retains a fixed number of old logs, deleting the oldest log whenever it adds a new one. The policy for log file size and retention can be adjusted by editing the agent.conf file. Look for the following element:


# Max size of the log file; the log rolls over after reaching this limit.
# The value may be suffixed with a unit: MB, KB, B. Without a unit, the
# value is interpreted as bytes. Defaults to 25MB.
logMaxSize = 50MB

# Maximum number of log files to accrue before deleting the oldest to make room
# for a new one. A value of 0 means never delete old log files.
# Defaults to 40.
logMaxFiles = 10

The 'logMaxFiles' in this example specifies the server should retain the most recent 10 log files. The 'logMaxSize' configures the server to roll the log file when it grows to 50 MB. This configuration limits the log files size to 500 MB from the default 1 GB.

After updating agent.conf, the agent must be restarted. On Linux, "/etc/init.d/ecmdrAgent restart". On Windows, Control Panel, Administrative tools, Services, ElectricCommander Agent, Properties, General (tab), Stop, then Start.

Applies to

  • Product versions: ElectricCommander 3.0 and later
  • OS versions: Any supported ElectricCommander operating system
Have more questions? Submit a request

Comments

Powered by Zendesk