14.5 Property setup file for the user log of Java applications

Organization of this section
(1) Format
(2) Functionality
(3) File name
(4) Specifiable keys
(5) Examples of coding

(1) Format

J2SE property file format.

Specify the key as follows:

key-name=value

Specification method
  • The string up to the linefeed is a value.
  • The line beginning with a hash mark (#) is a comment.
  • If you define a line without a value, the line is ignored.
  • You cannot add alphanumeric strings such as spaces and comments after the value. If you add such values, they will be considered as invalid.
(Example) key-name=value#comment

(2) Functionality

This file specifies the system properties for the user log in the Java application when using the vbj command.

The properties set up in this file are read by the Java application and hence, you need to set the properties in the system properties. For details on the implementation of user log output in Java applications, see 9.11 Implementing and setting up user log output for EJB client applications (when vbj command is used) in the manual uCosminexus Application Server Expansion Guide.

(3) File name

Any storage location and file name is possible.

(4) Specifiable keys

The following table lists the keys that can be specified. For details on the keys, see 14.3(4)(a) Keys beginning with ejbserver.application. Also, if required, see 2.4(5)(b) Keys beginning with ejbserver.application.

Table 14-4 Keys that can be specified in the property setup file for the user log of the Java application

Key nameContents
ejbserver.application.userlog.CJLogHandler.handler-name.appnameSpecify the default application name that is output to the AppName field.
ejbserver.application.userlog.CJLogHandler.handler-name.autoFlush.enabledSpecify whether flush is to be carried out after the message is output.
ejbserver.application.userlog.CJLogHandler.handler-name.countSpecify the number of log files.
ejbserver.application.userlog.CJLogHandler.handler-name.encodingSpecify encoding of the character strings to be output.
ejbserver.application.userlog.CJLogHandler.handler-name.filterSpecify the filter to be used with its full name, including the package name.
ejbserver.application.userlog.CJLogHandler.handler-name.formatterSpecify the formatter that you will use along with its full name, including the package name.
ejbserver.application.userlog.CJLogHandler.handler-name.levelSpecify an upper-limit of a log collection level.
ejbserver.application.userlog.CJLogHandler.handler-name.limitSpecify the capacity of a log file.
ejbserver.application.userlog.CJLogHandler.handler-name.msgidSpecify the default message ID that is output to the MsgID field.
ejbserver.application.userlog.CJLogHandler.handler-name.pathSpecify the prefix of log file name.
ejbserver.application.userlog.CJLogHandler.handler-name.separatorUse the CJSimpleFormatter and specify a separator to output a message in one sentence.
ejbserver.application.userlog.loggersDeclare the names of the loggers to be used.
ejbserver.application.userlog.Logger.logger-name.filterSpecify the full name including the package name of the filter used in the logger.
ejbserver.application.userlog.Logger.logger-name.handlersSpecify the handler class for the specified logger name.
ejbserver.application.userlog.Logger.logger-name.levelSpecify the output level of the logger.
ejbserver.application.userlog.Logger.logger-name.useParentHandlersSpecify whether the log record is to be transmitted from the logger that received the log record to the handler connected to the parent logger.

(5) Examples of coding

The storage location is as follows:

A sample is as follows:

# user-log handler function
ejbserver.application.userlog.CJLogHandler.conf1.appname=my_app1
ejbserver.application.userlog.CJLogHandler.conf1.path=application1/logfileA
ejbserver.application.userlog.CJLogHandler.conf1.limit=10485760​
ejbserver.application.userlog.CJLogHandler.conf1.count=2
ejbserver.application.userlog.CJLogHandler.conf1.level=SEVERE
 
# user-log logger function
ejbserver.application.userlog.Logger.com.example.userlogger1.handlers=com.hitachi.software.ejb.application.userlog.CJMPMessageFileHandler;conf1
ejbserver.application.userlog.Logger.com.example.userlogger1.useParentHandlers=true
ejbserver.application.userlog.Logger.com.example.userlogger1.level=INFO
ejbserver.application.userlog.loggers=com.example.userlogger1