Hi,

Given that the Category and Priority classes are now deprecated, I am looking 
for an alternative API for 
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Category.html#log(java.lang.String,
 org.apache.log4j.Priority, java.lang.Object, 
java.lang.Throwable)<http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Category.html#log(java.lang.String,%20org.apache.log4j.Priority,%20java.lang.Object,%20java.lang.Throwable)>".

My usecase consists of the logging being done by a generic helper class. 
Because of this, the method name printed in the log file is always that of the 
wrapper method of this helper class. The above log() API allows me to pass in 
the name of the helper class so that the resulting log prints the name of the 
actual calling method - as required.

Ex, MyClass.myMethod() needs to log a debug message. It calls 
MyHelper.debugWrapper(). The resulting log entry will look like,
DEBUG [Thread-Name] mypkg.MyClass.debugWrapper(): my message string
If, within MyHelper.debugWrapper(), instead of calling logger.debug(), I call 
log(mypkg.MyHelper, Priority.DEBUG, myMessage, null), the resulting log entry 
is,
DEBUG [Thread-Name] mypkg.MyClass.myMethod(): my message string

Kindly assist.

Thanks.

Amardeep

Reply via email to