Configuring the logging of sessions ran on a AIMMS PRO on Premise

This article contains an example of configuring the logging of an application that is published on an AIMMS PRO on Premise platform.

Note

The AIMMS log files are created by AIMMS staff and designed to be interpreted by AIMMS staff. The meaning of log entries may not be obvious. An error or warning message in the log file does NOT necessarily indicate a problem in the application.

Running example

A transport problem with two bottling locations of fresh water and two distribution centers. AIMMS project download

Packed

In the .aimmspack, also a LoggerConfig.xml file is enclosed. Some parts that are specific to logging for AIMMS PRO on Prem sessions are:

The appender used.

 1<appender name="logfile" class="org.apache.log4j.rolling.RollingFileAppender">
 2    <rollingPolicy class="org.apache.log4j.rolling.FixedWindowRollingPolicy">
 3        <param name="FileNamePattern" value="${AIMMSPRO_DATADIR}/Log/Sessions/%X{projectName}-%X{projectVersion}-%X{startupMode}-%X{timeStamp}-%X{sessionId}-%i.log"/>
 4        <param name="MinIndex" value="1"/>
 5        <param name="MaxIndex" value="10"/>
 6    </rollingPolicy>
 7    <triggeringPolicy class="org.apache.log4j.rolling.SizeBasedTriggeringPolicy">
 8        <param name="MaxFileSize" value="50MB"/>
 9    </triggeringPolicy>
10    <layout class="org.apache.log4j.PatternLayout">
11        <param name="ConversionPattern" value="%d{ISO8601} %t [%p] {%c} %m%n"/>
12    </layout>
13</appender>

Important in the LoggerConfig.xml file:

  1. Line 3: File naming, such that not only the

  2. Line 7: Pattern - especially the %d{ISO8601} such that dates can be matched.

When reporting back on an issue, including a moment when the incident happened, this information is essential.

A second part that is essential is that the above described appender, is indeed activated.

1<root>
2    <level value="info" />
3    <appender-ref ref="logfile" />
4</root>

This test

In the LoggerConfig.xml file of the enclosed example the following logger is added:

1<logger name="AIMMS.Trace.Procedure">
2    <!--- Tracing entering and leaving AIMMS Procedures.
3          Put this logger to trace if you need this information.
4    -->
5    <level value="trace"/>
6</logger>

This logger will trace starting and finishing of AIMMS procedures. An excerpt from the log file is:

12020-11-14 16:24:03,259 0x00003268 [DEBUG] {AIMMS.Trace.Procedure} Starting Procedure  pr_ME1
22020-11-14 16:24:03,259 0x00003268 [DEBUG] {AIMMS.Trace.Procedure} Starting Procedure  pr_ME2
32020-11-14 16:24:03,261 0x00003268 [DEBUG] {AIMMS.Trace.Procedure} Finishing Procedure pr_ME2
42020-11-14 16:24:03,261 0x00003268 [DEBUG] {AIMMS.Trace.Procedure} Finishing Procedure pr_ME1
52020-11-14 16:24:03,261 0x00003268 [DEBUG] {AIMMS.Trace.Procedure} Finishing Procedure MainExecution

Also provided

The following ZIP file contains a LoggerConfig.xml that can be added to any project. You will need to add the loggers you deem necessary, or are advised to you.

AIMMS project download