Log handlers, Formatter – HP Integrity NonStop H-Series User Manual
Page 75

Log handlers
A logger can be configured with one or more handlers. Upon receiving a log message, the logger
provides the handler the message to publish. The handlers are configured to format the log message,
and then publish them to a destination configured in the handler. NSASJ provides multiple handler
implementations.
lists all such handlers and provides description for them.
Table 23 Various handlers
Description
Handler Name
The Console log handler publishes messages to the standard output (stdout).
The messages from a console handler are not saved unless the operating system
is configured to capture the messages in a file.
Console
The File log handler captures all messages in a file.
File
The Periodic file handler writes log messages to a named file until a specified
period of time has elapsed. Once the time period is over, the file is renamed by
Periodic
appending the specified timestamp. However, the handler continues to write into
a newly created log file with the original name.
The Size log handler writes log messages to a named file until the file reaches a
specified size. When the file reaches a specified size, it is renamed with a numeric
Size
prefix and the handler continues to write into a newly created log file with the
original name. Each Size log handler must specify the maximum number of files
to be kept in this format.
The Async log handler is a wrapper log handler that provides asynchronous
behavior for one or more different log handlers. It is useful for log handlers that
Async
might have high latency or other performance problems such as writing a log file
to a network file system.
The Custom log handler helps to configure new types of log handlers that are
implemented. A custom handler must be implemented as a Java class that extends
Custom
java.util.logging.Handler
, and be contained in a module. A custom
handler is used to log messages to EMS.
Formatter
A log formatter is the configuration property of a log handler that defines the appearance of log
messages from that handler. It is a string that uses a syntax based on java.util.Formatter
class. For example, the log formatter string from the default configuration, %d{HH:mm:ss,SSS}
%-5p [%c](%t) %s%E%n
, creates log messages like 15:53:26,546 INFO [org.jboss.as]
(Controller Boot Thread) JBAS015951: Admin console listening on
http://127.0.0.1:9990
.
lists all the symbols and their corresponding
descriptions. Various combinations of these symbols can be used to format the display text.
Table 24 Symbols and descriptions
Description
Symbols
Specifies the category of the logging event.
%c
Specifies the name of the class from where the message originated. Obtaining
the name of the class is a slightly costly operation when compared to others.
%C
The logging infrastructure obtains a stack trace at the point the message is
logged, and then obtains the class name, method name and line number of
the origin of the message. This means the values for the symbols “C”, “F”, “M”
and “L” are all obtained with one operation.
Specifies the date when the logging event occurred. The default date format is
yyyy-MM-dd HH:mm:ss,SSS
. This can be overridden in the format string
itself.
%d
Specifies the stack trace of any exception that needs to be logged. The
information that is logged does not contain any extended module information.
%e
Logging
75