Hitachi

uCosminexus Application Server Expansion Guide


8.2.2 Mechanism of the user log output

You can use the Java logging APIs of J2SE for executing J2EE applications, batch applications, and EJB client applications to output user logs. A Java logging API is a highly versatile API that can output multiple items such as memories, consoles, and files. However, the logic is simple, so for applying the logic to a mission critical system, an application developer must implement reliable and durable classes for log output.

If you use the user log functionality, a highly reliable user log can be output, even if the classes for the log output are not implemented by the application developer.

You can output logs, which are output from J2EE applications, batch applications, and EJB client applications developed by using the Java logging APIs, in a format output by a component software of another Cosminexus system (Hitachi Trace Common Library format) by using Hitachi Trace Common Library. By using this library you can handle user logs in the same format as the other system logs, and the log operation can be highly reliable and unified.

You execute the user log output in accordance with the mechanism of the J2SE Java logging. With the Java logging, you use two types of elements, loggers and handlers. Note that loggers and handlers are the objects of the Logger class and the Handler class respectively.

The following figure shows the mechanism of Java logging.

Figure 8‒2: Mechanism of Java logging

[Figure]

The following points describe the above figure:

  1. Output user logs from applications by using logger.

    The user logs are output by using the methods of the Logger class, when the application is processing.

  2. Logger adds additional information such as levels and message strings to the log, which is output from the application, converts to LogRecord, and passes to the handler.

    At that time, you can have fine control above the control specified as a log level, by using the filter (object of the Filter class) that is connected to the logger.

  3. Based on the received LogRecord, the handler outputs logs to a file, console or a socket.

    You specify the output destination and the output format as a handler property, in advance. In handler, you can have fine control by using the filter connected to the handler. You can also use the formatter (object of the Formatter class) to output messages formatted in any format.

With Application Server, the file handlers are provided to output logs in the Hitachi Trace Common Library format, in a file. The following sub-sections describe the provided file handlers for respective applications.