Log settings in Nexus Timestamp Server
This article describes the log settings in Nexus Timestamp Server.
The server logging in Nexus Timestamp Server is based on the Java logging subsystem which introduces the concept of loggers and handlers.
Loggers are small components to which the Nexus Timestamp Server appends log entries.
A logger forwards log entries to a handler which is responsible for outputting the message to some log target such as text file.
The logging parameters are set in logging.properties.
Step-by-step instructions
Configure loggers
Open logging.properties.
Configure the log level per logger. Parameters are prefixed with the logger name. In the default configuration four loggers are defined as follows:
CODEse.nexus.level = INFO com.id2tech.level = INFO com.nexussafe.level = INFO nano.audit.level= INFO
Define a handler
A handler configuration defines the log target location, output format etc. Also, every log entry is logged on a specific level and log entries may be dropped by a logger or handler based on configured level. In the default configuration, Nexus Timestamp Server uses the TimeRollingFileHandler
.
Open logging.properties.
Define a handler with a
formatter
,pattern
and optionally alevel
. Parameters are prefixed with the handler name.CODEcom.id2tech.logging.TimeRollingFileHandler.pattern = %5$s/logs/%ty-%<tm-%<td/timestamp.log com.id2tech.logging.TimeRollingFileHandler.level = INFO com.id2tech.logging.TimeRollingFileHandler.formatter = com.id2tech.logging.OneLineMessageFormatFormatter
Change log file rotation
In order for log files not to grow infinitely, the TimeRollingFileHandler
rotates the log files based on time. In the default configuration the files are rotated each day.
The file rolling interval is determined by the time component in the pattern configuration. The pattern is formed using:
the current time (%1$),
the user home (%2$),
temp directory (%3$) and
var directory (%5$) as positional parameters.
The time components can be referenced by %1$tY %1$tm %1$td %1$tH %1$tM for year, month, day, hour, minutes respectively, or also as %ty %<tm %<td %<tH %<tM (< = use previous positional argument).
%5$s/logs/%ty-%<tm-%<td-%<tH-%<tM/timestamp.log
Change log level
Normally the log level is changed by changing the handler level parameter. But the level can also be controlled per logger. Log levels used in Nexus Timestamp Server are:
SEVERE: Entries that may cause the server to stop responding are logged on this level.
WARNING: Log entries on this level indicate to the administrator that system adjustments might be needed.
INFO: Informative entries, mainly outputted during startup and shutdown.
FINE: Debug information entries.
FINER: Finer-grade debug information.
FINEST: The finest grade of debug information.