Logging - SuperSERVER
SuperSERVER logs information during its operation to the SuperSERVER logs directory (for example: C:\ProgramData\STR\SuperSERVER SA\logs if you installed SuperSERVER to the default location):
- The settings for SuperSERVER logging are defined in C:\ProgramData\STR\SuperSERVER SA\ log4j.scsa.xml
- The log file is configured to roll to a new file on a daily basis.
You can change the logging level, if necessary.
Logging Levels
Logging is provided by the Apache component Log4j, which has six levels of logging. These levels are (listed in order, from most verbose to least verbose):
TRACE | Most verbose. All possible messages are written to the logs. |
---|---|
DEBUG | Logs everything except TRACE messages. |
INFO | This is the default setting. Recommended for production use. Logs INFO , WARN , ERROR and FATAL messages. |
WARN | Logs only WARN , ERROR and FATAL messages. |
ERROR | Logs only ERROR and FATAL messages. |
FATAL | Least verbose. Only FATAL errors are logged. |
Increase or Decrease the Amount of Information Logged
By default, SuperSERVER is configured to log at the INFO
level. This means that all INFO
, WARN
, ERROR
, and FATAL
messages are logged.
You can change this by editing this section:
<root>
<level value ="INFO" />
<appender-ref ref="MainLog" />
<appender-ref ref="CONSOLE"/>
</root>
For example, to change to the DEBUG
level, you could change this to:
<root>
<level value ="DEBUG" />
<appender-ref ref="MainLog" />
<appender-ref ref="CONSOLE"/>
</root>
This will configure SuperSERVER to log DEBUG
messages, in addition to INFO
, WARN
, ERROR
, and FATAL
messages.
Change the Log Level for an Individual Message Context
The above example changes the root logging level. This is a global setting that applies to all log messages from SuperSERVER.
If you need finer grained control over logging, you can set different logging levels for different types of message (referred to as "message contexts"). For example, if you were debugging a Data Control API plugin, you might want to set a higher level of logging for messages from your plugin, without changing the global level for the whole of SuperSERVER.
To configure logging for a specific message context, add a section similar to the following (replace <message_context>
with the context and <level>
with one of the levels listed above):
<logger name="<message-context>" additivity="false">
<level value ="<level>" />
<appender-ref ref="MainLog" />
<appender-ref ref="CONSOLE"/>
</logger>
You can find the message context by looking at the existing log messages; the context appears at the start of the message after the time and the logging level.
For example, the following excerpt from a SuperSERVER log shows two messages. The first has the context AUDIT_DataServer
and the second message has the context AUDIT_Session
:
13:12:27 2014/08/01, INFO, AUDIT_DataServer, "Accepting CORBA Client Requests on Address inet:MyServer:9232"
14:12:19 2014/08/01, INFO, AUDIT_Session, "User user1 on server_name=localhost, server_port=8080, remote_host=127.0.0.1, remote_port=56159 ( local_addr=127.0.0.1, local_port=8080, remote_addr=127.0.0.1, remote_port=56159, SW2_sessionid=36949EBBEE463F2291B51E6F7746003F ) using SuperWEB2, Logged In (user permissions)"
Suppose you wanted to set the global logging level to WARN
, but log AUDIT_Session
messages at the higher INFO
level. You could do this by:
Updating the root logger setting to:
XML<root> <level value ="WARN" /> <appender-ref ref="MainLog" /> <appender-ref ref="CONSOLE"/> </root>
Adding the following context specific setting at the bottom of the properties file:
XML<logger name="AUDIT_Session" additivity="false"> <level value ="INFO" /> <appender-ref ref="MainLog" /> <appender-ref ref="CONSOLE"/> </logger>
If you are debugging a Data Control plugin, you might want to set the following context-specific setting to log at the DEBUG
level for your component:
<logger name="AUDIT_DataServer.Dcapi" additivity="false">
<level value ="DEBUG" />
<appender-ref ref="MainLog" />
<appender-ref ref="CONSOLE"/>
</logger>
Change the Log File Location
By default the log file is written to the SuperSERVER logs directory. You can change the location of the log output if necessary.
You can change the log file location by editing the File
and FileNamePattern
in the MainLog
and StructuredAudit
log sections:
<appender name="MainLog" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="File" value="${LOG_PATH}/${LOG_BASE_NAME}.logs.txt"/>
<param name="Append" value="true"/>
<param name="Encoding" value="UTF-8"/>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="${LOG_PATH}/${LOG_BASE_NAME}-%d{yyyy-MM-dd}.logs.txt"/>
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{%H:%M:%S %Y/%m/%d}, %p, %c, '%m' %n"/>
</layout>
</appender>
<appender name="StructuredAudit" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="File" value="${LOG_PATH}/${LOG_BASE_NAME}-structuredaudit.logs.txt"/>
<param name="Append" value="true"/>
<param name="Encoding" value="UTF-8"/>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="${LOG_PATH}/${LOG_BASE_NAME}-structuredaudit-%d{yyyy-MM-dd}.logs.txt"/>
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n"/>
</layout>
</appender>
These settings control the filenames of SuperSERVER's main log file and its audit log file. In each case, the File
setting controls the filename of the current log file, while the FilenamePattern
setting in the <rollingPolicy/>
section controls the name that will be used when the log file rolls at the end of each day.
For example:
<appender name="MainLog" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="File" value="C:/Logs/${LOG_BASE_NAME}.logs.txt"/>
<param name="Append" value="true"/>
<param name="Encoding" value="UTF-8"/>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="C:/Logs/${LOG_BASE_NAME}-%d{yyyy-MM-dd}.logs.txt"/>
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{%H:%M:%S %Y/%m/%d}, %p, %c, '%m' %n"/>
</layout>
</appender>
<appender name="StructuredAudit" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="File" value="C:/AuditLogs/${LOG_BASE_NAME}-structuredaudit.logs.txt"/>
<param name="Append" value="true"/>
<param name="Encoding" value="UTF-8"/>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="C:/AuditLogs/${LOG_BASE_NAME}-structuredaudit-%d{yyyy-MM-dd}.logs.txt"/>
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n"/>
</layout>
</appender>
Learn More
Other SuperSTAR components have their own individual logging settings. For more information, see:
- Logging - SuperADMIN
- Logging - Metadata Server
- Logging - Production System
- Logging - SuperWEB2
- Logging - Job Queue Manager
- Logging - User Data Repository
In addition, SuperSTAR has an optional Audit Logging component that can be used to track user activity.
For more information about Log4j, refer to the Apache documentation: http://logging.apache.org/log4j/1.2/manual.html.