Since 1992


                   Swing support
                   Server application
       Promote your software
 Contact Us
© 2012 BeeSoft ®


Our logging package was created long in the past to ensure the independence of our applications from logging subsystem. It is just a facade before real logging system.

Programmer will work with an implementation of the interface eu.beesoft.gaoa.log.Log.

There are four logging levels:

  • INFO

For each level exist these methods:

  • isLevelEnabled()
  • level(String)
  • level(String, Throwable)
  • level(String, Object...)
where 'level' is used for one of 'debug', 'info', 'warn', 'error'.

Please note the last method: you can use it to merge any number of parameters to logged message. In these methods is each character pair {} replaced by one of the given parameters. For example you can log:

	info ("Current array index is {} of {}", 2, 5);

and logged message is Current array index is 2 of 5.

On the DEBUG level you can also use methods for logging of entering and exiting method.

The concrete implementation of Log interface can be obtained from LogFactory. It is an abstract superclass for all log factories. It serves as a factory of logger instances for different logging systems. Current factory can be obtained by LogFactory.getInstance() method. The typical usage scenario is like this:

	LogFactory factory = LogFactory.getInstance ();
	Log log = factory.getLog ("mypackage.MyClass");
	if (log.isDebugEnabled ()) {
		log.debug ("This is logged message");

This class also offers methods setThreadBoundIdentifier(String) and getThreadBoundIdentifier() to create link between current thread and an identifier defined by programmer. You can use them to log records with user name, for example. This is useful in server applications, where is difficult to pair a thread to the active client.

To customize this class to the requested logging system, you have to override createLog(String) method for your needs and to subclass the AbstractLog class. There are prepared implementations for:

  • Java (java.util.logging) system
  • Log4J (org.apache.log4j) system
  • Apache logging (org.apache.commons.logging) system

To use some of these logging systems you have to configure the underlaying real subsystem and create a corresponding factory by invoking its constructor (for example, for Log4J subsystem you need eu.beesoft.gaia.log.log4j.Log4jFactory instance). Then you can use the pattern from the introduction in your application.