Logging
Metadata Server 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 Metadata Server logging are defined in C:\ProgramData\STR\SuperSERVER SA\log4j.mdcorbaserver_sa.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, Metadata Server 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 Metadata Server 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 Metadata Server.
If you need finer grained control over logging, you can set different logging levels for different types of message (referred to as "message contexts").
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 Metadata Server log shows two messages. The first has the context MetadataSERVER.Startup
and the second message has the context MetadataSERVER.Connection
:
15:40:46 2014/08/01, INFO, MetadataSERVER.Startup, "Connected to SuperADMIN."
15:40:46 2014/08/01, INFO, MetadataSERVER.Startup, "Running"
15:41:49 2014/08/01, INFO, MetadataSERVER.Connection, "Requested Meta Access by a client"
Suppose you wanted to set the global logging level to WARN
, but log MetadataSERVER.Connection
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="MetadataSERVER.Connection" additivity="false"> <level value ="INFO" /> <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
section:
<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>
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>
Learn More
Other SuperSTAR components have their own individual logging settings. For more information, see:
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.