You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Debasis Das <de...@india.hp.com> on 2003/04/30 12:58:16 UTC

How to get Method Name and Class Name

Hi,
   I want to display method name and class name in the log output. Since
I am using a wrapper class over log4j's logger class, I can't use the
default conversion pattern.
Appriciate any help.

Thanks
Debasis


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


Re: How to get Method Name and Class Name

Posted by Ceki Gülcü <ce...@qos.ch>.
Sorry for the mess below.

The signature is:

log(String callerFQCN, Priority level, Object message, Throwable t)

At 01:49 PM 4/30/2003 +0200, you wrote:
>Debasis,
>
>Actually you can. In your wrapper class you have to call the log method of 
>Logger (or Category) taking the caller's fully qualified class name.
>
>The signature is:
>
><../../../org/apache/log4j/Category.htm#log(java.lang.String, 
>org.apache.log4j.Priority, java.lang.Object, 
>java.lang.Throwable)>log(<http://java.sun.com/products/jdk/1.3/docs/api/java/lang/String.html>String 
>callerFQCN, <../../../org/apache/log4j/Priority.htm>Priority level, 
><http://java.sun.com/products/jdk/1.3/docs/api/java/lang/Object.html>Object 
>  message, 
><http://java.sun.com/products/jdk/1.3/docs/api/java/lang/Throwable.html>Throwable 
>t)
>
>Try it.
>
>At 04:28 PM 4/30/2003 +0530, you wrote:
>>Hi,
>>    I want to display method name and class name in the log output. Since
>>I am using a wrapper class over log4j's logger class, I can't use the
>>default conversion pattern.
>>Appriciate any help.
>>
>>Thanks
>>Debasis
>
>--
>Ceki  For log4j documentation consider "The complete log4j manual"
>       http://www.qos.ch/shop/products/clm_t.jsp
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>

--
Ceki  For log4j documentation consider "The complete log4j manual"
       http://www.qos.ch/shop/products/clm_t.jsp 


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


Re: How to get Method Name and Class Name

Posted by Ceki Gülcü <ce...@qos.ch>.
Debasis,

Actually you can. In your wrapper class you have to call the log method of 
Logger (or Category) taking the caller's fully qualified class name.

The signature is:

<../../../org/apache/log4j/Category.htm#log(java.lang.String, 
org.apache.log4j.Priority, java.lang.Object, 
java.lang.Throwable)>log(<http://java.sun.com/products/jdk/1.3/docs/api/java/lang/String.html>String 
callerFQCN, <../../../org/apache/log4j/Priority.htm>Priority level, 
<http://java.sun.com/products/jdk/1.3/docs/api/java/lang/Object.html>Object 
message, 
<http://java.sun.com/products/jdk/1.3/docs/api/java/lang/Throwable.html>Throwable 
t)

Try it.

At 04:28 PM 4/30/2003 +0530, you wrote:
>Hi,
>    I want to display method name and class name in the log output. Since
>I am using a wrapper class over log4j's logger class, I can't use the
>default conversion pattern.
>Appriciate any help.
>
>Thanks
>Debasis

--
Ceki  For log4j documentation consider "The complete log4j manual"
       http://www.qos.ch/shop/products/clm_t.jsp 


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