Its really just log4j stuff. All that we are doing is introducing a facade
over
the log4j Category to directly support the use of the custom trace priority
and hide all of the non-logging methods.
The first thing you need to decide is what is the category name your going
to use. This should be based on the class name of the component doing
the logging. If there are multiple instances of a component, and it is
associated with another meaningful name, this name will be
added as a subcategory to the component class name. For example,
the org.jboss.security.plugins.JaasSecurityManager class uses
a base category name equal to its class name. There can be
multiple JaasSecurityManager instances, and each is associated
with a security domain name. Therefore, the complete log4j
category name used by the JaasSecurityManager is
"org.jboss.security.plugins.JaasSecurityManager.securityDomain",
where the securityDomain value is the name of the associated
security domain.
To create a Logger for JaasSecurityManager this is the code snippet:
package org.jboss.security.plugins;
import org.jboss.logging.Logger;
public class JaasSecurityManager ...
{
Logger log;
public JaasSecurityManager (String securityDomain)
{
String name = JaasSecurityManager.class + '.' + securityDomain;
log = Logger.getLogger(name);
}
}
After that just use the log with whatever priority level is approriate.
Activating the TRACE level priority is done by adding a category threshold
statement to the log4j.properties file. To enable tracing for a particular
JaasSecurityManager security domain called other I would add:
log4j.category.org.jboss.security.plugins.JaasSecurityManager.other=TRACE#or
g.jboss.logging.log4j.TracePriority
To enable the TRACE level priority for all JaasSecurityManager instances I
would add:
log4j.category.org.jboss.security.plugins.JaasSecurityManager=TRACE#org.jbos
s.logging.log4j.TracePriority
To enable the TRACE level priority for all components in the security pkg:
log4j.category.org.jboss.security=TRACE#org.jboss.logging.log4j.TracePriorit
y
You can also redirect a given categories message to a seperate log file or
endpoint
by assiging it a different appender. For example, to redirect all security
output to
a security.log file, and set the security package threshold to TRACE use:
### The security.log file appender
log4j.appender.SecurityLog=org.apache.log4j.FileAppender
log4j.appender.SecurityLog.File=../log/security.log
log4j.appender.SecurityLog.layout=org.apache.log4j.PatternLayout
log4j.appender.SecurityLog.layout.ConversionPattern=[%c{1}] %m%n
log4j.appender.SecurityLog.Append=false
log4j.category.org.jboss.security=TRACE#org.jboss.logging.log4j.TracePriorit
y, SecurityLog
----- Original Message -----
From: "Dain Sundstrom" <[EMAIL PROTECTED]>
To: "'Scott M Stark'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Thursday, November 15, 2001 3:34 PM
Subject: RE: [JBoss-dev] org.jboss.logging.Logger priority usage
recommendations
> Can you supply the quick 5 line example on properly creating loggers and
> logging a message. I have been having trouble changing the log levels for
> cmp. I tried and failed to turn only the CMP channel up to DEFAULT for
the
> console appender for my testing, so I end up turning up the entire console
> appender to DEFAULT. Do we have docs on this somewhere (not that you need
to
> write some, just wondering)?
>
> -dain
>
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development