logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: Alternative API for Category.log()
Date Fri, 06 Jul 2012 20:02:42 GMT

If you are worried about said method being removed, don't worry.  But you 
should reference it via the Logger class.  Logger and Level replace Category 
and Priority.  But even if you were to reference it with the deprecated 
classes, you'll have no problems.  They will never be removed as Log4j-1.2.x 
won't ever be significantly changed.  Only bugfixes and maybe minor features 
will be applied.

All new development is occurring in the Log4j2 [2] codebase, but it's still in 
alpha for now.

[2] http://loggingtest.apache.org/log4j/2.x/


Jake

On Thu, 5 Jul 2012 21:15:32 +0000
 "Sira, Amardeep" <amardeep.sira@etrade.com> wrote:
> 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
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message