Reference‎ > ‎

Logging

Logging is a critical part of the ABL engine, because it's often the only way to understand the behavior of your logic. The ABL engine uses Apache's Commons Logging package to remain independent of the underlying logging mechanism. By default, ABL will use Apache's log4j, but you are free to use other packages, such as Java's own logging mechanism.

Available loggers

The following is a list of the loggers used by the ABL engine.

 Logger name Used by
 abl.depend Dependency analysis
 abl.evtlst Event listener mechanism
 abl.generl General logging that doesn't really fit anywhere else
 abl.logfnd Logic finder: everything that has to do with locating logic classes
 abl.persis Persistence: any time the engine uses Hibernate to read or write data
 abl.buslog The business logic extensions
 abl.recomp The recompute facility
 abl.engine The ABL engine (internals)
 abl.sysdbg Internal debugging

In case you're curious about the abbreviated names, they're standardized at 3 + 6 characters so that logging messages will line up nicely in the log.

Logging configuration

The configuration for logging depends a great deal on which logging system you use. If you use log4j, the easiest way to configure logging is to have a file named log4j.properties in your classpath, and to specify the logging levels in it, for instance:

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%c - %m%n
log4j.rootLogger=info, stdout

log4j.logger.org.hibernate=info

log4j.logger.abl=debug
log4j.logger.abl.depend=warn
log4j.logger.abl.persis=info
log4j.logger.abl.engine=warn
log4j.logger.abl.evtlst=warn
log4j.logger.abl.recomp=debug
log4j.logger.abl.sysdbg=warn

If you use a different logging mechanism, you should refer to its documentation.

Changing the logging level at runtime

If may sometimes be desirable to change the logging level of a specific logger using the API. To do so, you will need to know in advance what logging system you are currently using (e.g. log4j, JDK logging, etc...). Given this, you can then use code similar to the following:

LogicLogger logicLogger = LogicLogger.getLogger(LoggerName.LOGICFINDER);
Log4JLogger log = (Log4JLogger)logicLogger.getLog(); // This is obviously specific to log4j
log.getLogger().setLevel(Level.DEBUG);

Comments