Hitachi

uCosminexus Application Server Expansion Guide


8.5 Implementation for user log output

You code using the Java logging APIs to output logs in J2EE applications or batch applications. If you want to output the names and message IDs of J2EE applications or batch applications to a user log, you use the CJLogRecord class provided with Cosminexus.

The CJLogRecord class is a class that inherits the LogRecord class of the Java logging APIs. You can create a CJLogRecord object with the specified message ID and application name. You can output any message ID and application name to a user log by specifying the object created in this class, in the argument of a log method, in the Logger class.

Example to output a user log having application name "UserApp" and message ID "USER10000-E":
try{
  //Execute process that outputs an error
}
catch(Error ex){
   logger.log(CJLogRecord.create(Level.SEVERE, "Catch an exception", "UserApp", "USER10000-E"));
}

For details on APIs, see the uCosminexus Application Server API Reference Guide.