Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

de.danet.an.util.log4j
Class ApplLogger  view ApplLogger download ApplLogger.java

java.lang.Object
  extended byde.danet.an.util.log4j.ApplLogger

public class ApplLogger
extends java.lang.Object

This class provides an alternate access to the log4j logging library. The necessity arises from the usage of log4j as logging package in the JBoss application server. As log4j is already included in JBoss' classpath and configured by JBoss, we cannot have really independent application level logging.

The central problem is the static default hierarchy used by org.apache.log4j.Category. For a distinct application level logging we need an alternate hierarchy. Of course, we want to access this hierarchy as simple as Category.getInstance(...) and thus we need a new class that provides the static acces to the alternate (application level) hierarchy.

Note that no static methods of other log4j classes may be used in the context of this application level logging, as they usually rely on Category.getDefaultHierarchy() and that is not the application level hierarchy.

The naming of this class and its methods has already been aligned with the upcoming renaming in log4j 1.2.


Field Summary
private static java.net.URL cu
           
static org.apache.log4j.Hierarchy defaultHierarchy
           
private static org.apache.log4j.Category logger
           
static org.apache.log4j.spi.RootCategory rc
          The hierarchy used in ApplLogger.
 
Constructor Summary
ApplLogger()
           
 
Method Summary
static org.apache.log4j.Hierarchy getDefaultHierarchy()
          Return the default Hierarchy instance.
static org.apache.log4j.Category getLogger(java.lang.Class clazz)
          Shorthand for getInstance(clazz.getName()).
static org.apache.log4j.Category getLogger(java.lang.String name)
          Retrieve a category with named as the name parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rc

public static final org.apache.log4j.spi.RootCategory rc
The hierarchy used in ApplLogger.


defaultHierarchy

public static final org.apache.log4j.Hierarchy defaultHierarchy

cu

private static java.net.URL cu

logger

private static final org.apache.log4j.Category logger
Constructor Detail

ApplLogger

public ApplLogger()
Method Detail

getDefaultHierarchy

public static org.apache.log4j.Hierarchy getDefaultHierarchy()
Return the default Hierarchy instance.


getLogger

public static org.apache.log4j.Category getLogger(java.lang.String name)
Retrieve a category with named as the name parameter. If the named category already exists, then the existing instance will be reutrned. Otherwise, a new instance is created. By default, categories do not have a set priority but inherit it from the hierarchy. This is one of the central features of log4j.


getLogger

public static org.apache.log4j.Category getLogger(java.lang.Class clazz)
Shorthand for getInstance(clazz.getName()).