Arch4J 1.1

Class LoggingProvider

All Implemented Interfaces:

public class LoggingProvider
extends Object
implements LoggingConstants

This class is the main service provider for logging services. The services are accessed via the static getProvider() method. Typically, a logging category for a class is retrieved with code that looks like the following:

 public class MyClass {
   static LoggingCategory loggingCategory =
   public void aMethod() {"Entered method.");

The logging category can then be used to do the logging, using the methods available on LoggingCategory.

Additionally, there is a method named logSystemError(java.lang.String, java.lang.Throwable) that can be called directly on the provider to report system errors. Typically, this would only be used during statup or shutdown, or when the state of the system is in question. This method by-passes the logging manager (and any property lookup that it might use) to write a system-level error message directly to a failsafe category named system.

The reason the class is implemented the way it is is so that in the future, a static initialization block could be used to create the static instance, say via a property file. The manager could also be replaced with another class that implements the LoggingManager interface.

$Revision: 1.5 $
Ross E. Greinke

Field Summary
Fields inherited from interface org.arch4j.logging.LoggingConstants
Method Summary
 void configure()
          Configure the logging framework.
 LoggingCategory getCategory(String name)
          Retrieve a logging category with name name.
static LoggingProvider getProvider()
          Returns the single instance of the LoggingProvider.
 void logSystemError(String message, Throwable thrown)
          Log a system-level error message.
static void resetProvider()
          Reset the single instance of the LoggingProvider.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail


public static LoggingProvider getProvider()
Returns the single instance of the LoggingProvider.

The single instance of the LoggingProvider.


public static void resetProvider()
Reset the single instance of the LoggingProvider.


public LoggingCategory getCategory(String name)
Retrieve a logging category with name name.

name - The name of the logging category to retrieve.
The logging category to be used for logging.


public void configure()
Configure the logging framework.


public void logSystemError(String message,
                           Throwable thrown)
Log a system-level error message. The message is logged independently from the logging framework directly to a failsafe logger. If that fails, the message is written directly to the System.err stream.

This method should only be called by other framework providers when they are unsure of whether all the other frameworks have started cleanly, especially property management and startup.

message - The message to log.
thrown - A Throwable, which can be null.

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.