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 Ye Tao <ta...@yahoo.com> on 2001/02/24 09:14:30 UTC

Question: LocationInfo : %M, %L, %l

Hey gurus

For various reasons I am wrapping the log4j API's in a
homegrown Logger utility class. For example, I have an

info() method that calls Category.info() internally. 

The problem that I have now is with the location
information generated by %M, %L, or %l. The
LocationInfo.java obtains the location information by
parsing the stack trace printouts. It always return
the method just one frame up in the stack above 
org.apache.log4j.Category.log(), which in my case is
the info() method in my homegrown utility. This
basically leaves the %M, %L, %l useless to me as they
always report the location as in the utility class
instead of the one that calls the info() method. 

Is there any way around it? Like can I override the
default behavior from LocationInfo?

thanks a ton.

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Re: Question: LocationInfo : %M, %L, %l

Posted by Ye Tao <ta...@yahoo.com>.
Thanks a lot. that solved my problem. You are the man!

apparently I did not read the source code thoroughly.

--Ye

--- Ceki G�lc?<cg...@qos.ch> wrote:
> 
> Ye,
> 
> Have a look at the Category.log(String callerFQN,
> Priority priority, Object message, Throwable t)
> method. It should solve the problem you mention. Set
> the callerFQN to the fully qualified name of your
> wrapper/utility class. Cheers, Ceki
> 


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Re: Question: LocationInfo : %M, %L, %l

Posted by Ceki Gülcü <cg...@qos.ch>.
Ye,

Have a look at the Category.log(String callerFQN, Priority priority, Object message, Throwable t) method. It should solve the problem you mention. Set the callerFQN to the fully qualified name of your wrapper/utility class. Cheers, Ceki


At 00:14 24.02.2001 -0800, Ye Tao wrote:
>Hey gurus
>
>For various reasons I am wrapping the log4j API's in a
>homegrown Logger utility class. For example, I have an
>
>info() method that calls Category.info() internally. 
>
>The problem that I have now is with the location
>information generated by %M, %L, or %l. The
>LocationInfo.java obtains the location information by
>parsing the stack trace printouts. It always return
>the method just one frame up in the stack above 
>org.apache.log4j.Category.log(), which in my case is
>the info() method in my homegrown utility. This
>basically leaves the %M, %L, %l useless to me as they
>always report the location as in the utility class
>instead of the one that calls the info() method. 
>
>Is there any way around it? Like can I override the
>default behavior from LocationInfo?
>
>thanks a ton.
>
>__________________________________________________
>Do You Yahoo!?
>Get email at your own domain with Yahoo! Mail. 
>http://personal.mail.yahoo.com/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org

----
Ceki Gülcü          Web:   http://qos.ch      
av. de Rumine 5     email: cgu@qos.ch (preferred)
CH-1005 Lausanne           ceki_gulcu@yahoo.com
Switzerland         Tel: ++41 21 351 23 15