Hi,
I am using commons-logging and log4j
My commons-logging .properties is as shown below,
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl
org.apache.commons.logging.Log=com.logging.log4j.Log4jAdapter
I want to write one custom level called AUDIT in log4j
The problem is, that the log level is hard coded into
the method names of log interface of commons-logging
You have "log.error, log.debug, " on the Log
interface.
So let's extend it with a new level called "AUDIT"
/**
* <p> Is AUDIT logging currently enabled? </p>
*
* <p> Call this method to prevent having to
perform expensive operations * (for example,
<code>String</code> concatination)
* when the log level is more than the fatal
level. </p>
*/
public boolean isAuditEnabled();
/**
* <p> Log a message with AUDIT log level. </p>
*
* @param message log this message
*/
public void Audit(Object message);
Which would use a "Audit" log level set by a
In the Log4JAdapter this would be quite a simple
implementation:
public void audit(Object message) {
logger.log(FQCN, CustomLevel.Audit, message, null);
}
so can you please tellme how can i extend the
LogFactoryImpl and create the code for me, if u have
please send the code to me
currently i am using this way
private static final Log log =
LogFactory.getLog(ManagerImpl.class);
if (log.isDebugEnabled())
log.debug(props);
I need to add and call new level Audit which i already
created in log4j, i should use this way
if (
log.isAuditEnabled())
log.audit(props);
Thanks
Sreenivas
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 1GB free storage!
http://sg.whatsnew.mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]