Logging

During loggin, ClassiX® keeps record of different states, problem reports, activities etc. and writes everything into a specific format in a medium, such as a file.

A log4j- compatible logging library takes over the technical part.

The configuration file is in the ClassiX® system directory (CX_SYSTEM) and is called logging.ini. The file name can be modified via command line or via environment variable:

The environment variable has the highest priority.

The configuration file is made of two parts: the logger and the output media. The following example describes two loggers, that are writing into an output medium (file):

log4cplus.rootLogger=INFO, FILE_LOGGER

log4cplus.appender.FILE_LOGGER=log4cplus::RollingFileAppender
log4cplus.appender.FILE_LOGGER.File=${CX_LOGFILENAME}.log
log4cplus.appender.FILE_LOGGER.ImmediateFlush=true
log4cplus.appender.FILE_LOGGER.Append=true
log4cplus.appender.FILE_LOGGER.MaxFileSize=1MB
log4cplus.appender.FILE_LOGGER.MaxBackupIndex=5
log4cplus.appender.FILE_LOGGER.layout=log4cplus::PatternLayout
log4cplus.appender.FILE_LOGGER.layout.ConversionPattern=%D{%Y-%m-%d %H:%M:%S,%%q} %5p %c - %m%n

log4cplus.logger.cx.main=ALL

Logger

A logger is an object which collects all messages of a certain category (and its sub-categories) and writes it into media. The messages come from  ClassiX®. SystemObject::Log could also generate such messages.

In the example, the original logger "rootLogger" gets configured with the level INFO and with the medium FILE_LOGGER. All other loggers are derived from the "rootLogger" and inherit their characteristics. ClassiX® loggers usually start with "cx.".

The message "program start" and "program end" are sent to the logger "cx.main". The logging level will be switched to ALL, so they always appear in the log book. 

Logger Meaning
cx.app general application messages, such as problem report or messages via CX_SYSTEM_OBJECT::Log
cx.arena arena messages (memory administration)
cx.as messages for the address space administration (marker)
cx.basic basic class messages (currently only CX_NUMERIC and derived ones)
cx.gc garbage collection runs (also: CX_GARBAGE_LOGGING_THRESHOLD)
cx.instantview InstantView® messages, such as double-defined variables or messages
cx.instantview.parser InstantView® parser messages
cx.lic license manager messages
cx.listview ListView messages
cx.locale locale messages
cx.main logging frame with messages about program start and -end
cx.objectbrowser object browser messages
cx.omgr object manager messages
cx.omgr.db opening the database
cx.omgr.osversion ObjectStore versions and separate ObjectStore ID
cx.pool pool messages (memory administration)
cx.remote remote interface messages (e.g. CORBA)
cx.rqdsp request dispatcher messages (command execution)
cx.rqdsp.asf address space full error
cx.rqdsp.deadlock sub-category for deadlock handling
cx.rqdsp.deadlock.rcb resume control blocks output (also CX_DEBUG_RCB_QUEUE)
cx.rqdsp.time runtime of the InstantView macro (also CX_MACRO_LOGGING_THRESHOLD)
cx.test test message
cx.txn transaction manager (monitor for database transactions) (also CX_TXN_LOGGING_THRESHOLD)

Log level settings of a logger also apply to the dependent logger (unless the level gets redefined again for this level):

log4cplus.logger.cx=INFO                    # for all ClassiX® logger: INFO level
log4cplus.logger.cx.instantview=WARN        # InstantView® messages: only alerts and errors
log4cplus.logger.cx.rqdsp=ERROR             # request dispatcher: only errors,
log4cplus.logger.cx.rqdsp.deadlock=WARN     #  but for deadlock messages also alerts

Media

Every logging line can be exported in multiple media. The following media is currently supported:

ClassiX® generates the environment variable CX_LOGFILENAME, which includes a default file name including path. The path is the ClassiX® system directory, the file name starts with CX_, followed by the computer name, the user name and the process ID, extension is .log.
If the environment variable CX_LOGFILENAME has already been set, it will be overwritten for the running ClassiX process.
To manually assign the log file name, the entry needs to be adjusted accordingly in the logging.ini.

log4cplus.appender.FILE_LOGGER.File=${MY_FILE_NAME}.log       

This is not recommended though, since in this case, all events would be written into only one file, which makes the assignment to a user hard. Here, it is possible though, to access any environment variable, such as ${COMPUTERNAME} or ${USERNAME}.

Layout

Logging lines can be designed individually (s. log4j documentation for details):

Character Meaning
%D, %d time stamp (%D = local time, %d = UTC)
  %Y, %y year (4- or 2-digit)
  %m month
  %d day
  %H hour
  %M minute
  %S second
  %%q milli second
%p level
%c category
%m text
%n line break

Level

There are five different levels:

Level Description
DEBUG first level: highly detailled information
INFO general information
WARN warning
ERROR error
FATAL highest level: error which causes program abort

When setting a certain level in the logging.ini, all messages that are on this level or higher will be recorded. ALL also means all messages; OFF means no messages.