Scope
- JS7 makes use of Log4j2 for logging purposes. Log rotation is required to prevent log files from filling up disk space.
- The default configuration allows disk space consumption to be limited for each of Controller, Agent and JOC Cockpit.
- The configuration for rotating log files is similar for all JS7 components.
- Note that log output from orders and jobs in workflow is not stored with log files but is immediately added to the JS7 - Database and JS7 - History respectively.
Log4j2 Configuration Files
The Log4j2 configuration file is log4j2.xml and has the following default locations for each JS7 component:
Windows | Unix | |
---|---|---|
Controller | C:\Program Files\sos-berlin.com\js7\controller\lib\log42j.xml | /opt/sos-berlin.com/js7/controller/lib/log4j2,xml |
Agent | C:\Program Files\sos-berlin.com\js7\agent\lib\log42j.xml | /opt/sos-berlin.com/js7/agent/lib/log4j2,xml |
JOC Cockpit | C:\ProgramData\sos-berlin.com\js7\joc\jetty_base\resources\joc\log42j.xml | /var/sos-berlin.com/js7/joc/jetty_base/resources/joc/log4j2,xml |
Changes to the Log4j2 configuration are applied within 60s and do not require the JS7 component to be restarted.
Log Rotation Strategy
By default log files are rotated on the following events:
- if the size of a single log file exceeds 100MB or
- on day change.
If a log file is rotated then its name is appended the current date and a running number, in addition the log file is compressed, e.g. a log file controller.log
becomes controller-2021-01-31-1.log.gz
. The running number 1
indicates the first log file of the day being rotated.
Users are free to modify the Log4j2 configuration to apply their individual log rotation strategy, see the explanations for the examples below.
As an exception to this rule the watchdog log files for Controller and Agent, which are not subject to log rotation. The watchdog log file captures any output before the respective application is started, e.g. output of the Controller Windows Service, and therefore does not make use of Log4j2 for logging. The watchdog log files therefore should not grow but should report a few lines only in situations when a Controller or Agent could not be started.
Log Retention
By default the log retention period for any log files is 30 days, i.e. log files older than this will be removed.
Users are free to modify the Log4j2 configuration to apply their individual log retention period, see below examples explained.
Log retention does not apply to:
- the
audit.log
log file, which is rotated but is not subject to log retention and therefore is not removed or truncated. For compliance reasons theaudit.log
remains in place for an arbitrary duration. It's the user's responsibility to purge theaudit.log
to their requirements. - the
watchdog.log
files of Controller and Agent that hold any output created before the relevant application is started.
Configuration Files explained
Controller and Agent Log4j2 Configuration
Explanation:
- To modify the time zone that is applied to log entries and to the point in time of log rotation modify
<Property name="TimeZone">Etc/UTC</Property>
. The time zone is specified during the startscript by setting the environment variableSCHEDULER_TZ
. - To enable debug mode modify
<property name="RootLogLevel">INFO</property>
and<property name="LogLevelOfDebugLog">OFF</property>
toDEBUG.
- To change the log retention period modify
<Property name="RetainDays">30d</Property>
to some other value. Note the use of the suffixesd
(ays),w
(eeks),m
(onths). - To limit the max. size of individual log files modify
<Property name="MaxSizePerFile">100MB</Property>
to some other value. Note the use of the unitsMB
,GB
. - To limit space consumption of all log files modify
<Property name="MaxSizeOfRolledOverFiles">5GB</Property>
to some other value. Note the use of the unitsMB
,GB
.
JOC Cockpit Log4j2 Configuration
Explanation:
- To modify the time zone that is applied to log entries and to the point in time of log rotation modify
<Property name="TimeZone">Etc/UTC</Property>
. The time zone is specified during installation. - To change the log retention period modify
<Property name="RetainDays">30d</Property>
to some other value. Note the use of the suffixesd
(ays),w
(eeks),m
(onths). - To limit space consumption of all log files modify
<Property name="MaxSizeOfRolledOverFiles">5 GB</Property>
to some other value. Note the use of the unitsMB
,GB
. - To limit the max. size of individual log files modify
<Property name="MaxSizePerFile">100 MB</Property>
to some other value. Note the use of the unitsMB
,GB
. - To enable debug mode modify
<property name="RootLogLevel">INFO</property>
toDEBUG
. In addition modify the value of one or more of the following properties to enable debug output with the respective debug log file:Log File Property joc-debug.log
<Property name="JocLogLevel">DEBUG</Property>
service-cluster-debug.log
<Property name="ClusterLogLevel">DEBUG</Property>
service-history-debug.log
<Property name="HistoryLogLevel">DEBUG</Property>
service-dailyplan-debug.log
<Property name="DailyPlanLogLevel">DEBUG</Property>
service-cleanup-debug.log
<Property name="CleanupLogLevel">DEBUG</Property>
authentication-debug.log
<Property name="AuthLogLevel">DEBUG</Property>
connection-pool-debug.log
<Property name="ConnectionPoolLogLevel">DEBUG</Property>