|
Log4j 1.1b7 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.log4j.Category | +--org.apache.log4j.examples.appserver.AppServerCategory
Extends Category
by adding four text attributes
relevant to applications run in application servers.
These attributes are
This Category
subclass generates
AppServerLoggingEvent
subclasses of
LoggingEvent
which include the additional attributes.
AppServerPatternLayout
provides the ability to format these attributes.
Rather than set all these attributes for each
AppServerCategory
instance, it is usually more
convenient to set them on AppServerCategoryFactory
and associate this factory statically with
AppServerCategory
using the static
setFactory
method. The
AppServerCategory.getInstance(String)
method can
then be used to create AppServerCategory
instances conveniently.
Field Summary | |
protected String |
component
The name of the component using this category. |
protected String |
hostname
The hostname on which this category resides. |
protected String |
server
The application server name for this category. |
protected String |
version
An identifier for this particular version/release. |
Fields inherited from class org.apache.log4j.Category |
additive, DEFAULT_CONFIGURATION_FILE, DEFAULT_CONFIGURATION_KEY, DEFAULT_INIT_OVERRIDE_KEY, defaultHierarchy, hierarchy, name, parent, priority, resourceBundle |
Constructor Summary | |
protected |
AppServerCategory(String categoryName,
String hostname,
String server,
String component,
String version)
Construct a new AppServerCategory with the provided attributes. |
Method Summary | |
protected void |
forcedLog(String fqn,
Priority priority,
Object message,
Throwable t)
This method is overridden to ensure an instance of AppServerLoggingEvent is sent to the
appenders. |
String |
getComponent()
Get the component name for this category. |
String |
getHostname()
Get the hostname for this category. |
static Category |
getInstance(String name)
Return an AppServerCategory instance with the
provided name. |
String |
getServer()
Get the server name for this category. |
String |
getVersion()
Get the version name for this category. |
void |
setComponent(String componentName)
Set the component name for this category. |
static void |
setFactory(CategoryFactory factory)
Set the factory instance for creation of AppServerCategory instances.
in the getInstance method. |
void |
setHostname(String hostname)
Explicity set the hostname for this category. |
void |
setServer(String serverName)
Set the server name for this category. |
void |
setVersion(String versionName)
Set the version of the component for this category. |
Methods inherited from class org.apache.log4j.Category |
addAppender, assert, callAppenders, debug, debug, error, error, exists, fatal, fatal, getAdditivity, getAllAppenders, getAppender, getChainedPriority, getCurrentCategories, getDefaultHierarchy, getHierarchy, getInstance, getInstance, getName, getPriority, getResourceBundle, getResourceBundleString, getRoot, info, info, isDebugEnabled, isEnabledFor, isInfoEnabled, l7dlog, l7dlog, log, log, log, removeAllAppenders, removeAppender, removeAppender, setAdditivity, setPriority, setResourceBundle, shutdown, warn, warn |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String component
protected String hostname
protected String server
protected String version
Constructor Detail |
protected AppServerCategory(String categoryName, String hostname, String server, String component, String version)
categoryName
- the name of the category.instanceFCQN
- the fully qualified name of this category instancehostname
- the name of the physical machine on which this
category resides. This may be null.server
- the name of the server using this category. This
may be null.component
- the name of the component using this category.
This may be null.version
- the version identifier of the component. This may
may be null.Method Detail |
public String getComponent()
public String getHostname()
public static Category getInstance(String name)
AppServerCategory
instance with the
provided name. If such an instance exists, return it.
Otherwise, create a new one.name
- the name of the CatgoryAppServerCategory
. The
signature indicates Category
to maintain
compatibility with the base class.public String getServer()
public String getVersion()
protected void forcedLog(String fqn, Priority priority, Object message, Throwable t)
AppServerLoggingEvent
is sent to the
appenders.forcedLog
in class Category
public void setComponent(String componentName)
categoryName
- the component name to be used for this category.public static void setFactory(CategoryFactory factory)
AppServerCategory
instances.
in the getInstance
method.factory
- an AppServerCategory
factorypublic void setHostname(String hostname)
hostname
- the hostname to be used for this category.public void setServer(String serverName)
serverName
- the server name to be used for this category.
This is useful in CORBA and EJB environments.public void setVersion(String versionName)
versionName
- version name
|
Log4j 1.1b7 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |