commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trenton D. Adams" <tre...@athabascau.ca>
Subject Re: commons logging class level logging
Date Tue, 29 Mar 2005 16:58:20 GMT
Ok, this is slightly off topic for this list then.  But I'd appreciate 
any help.

What's the quickest and easiest way of my code knowing what class called 
a method?  The reason I ask is because we have some wrapper methods in 
our main class that every other class calls to do logging.  I would like 
that method to be able to determine what class it was that called, so 
that I could use the proper logger/category.

Also, for log4j, is Logger.getLogger("classname") an efficient way of 
getting a logger for each class?  e.g. should I be calling this method 
every time my *wrapper* log method is called?  How does the commons 
logging do this properly, surely it has to do something similar since 
it's a wrapper too?

Simon Kitching wrote:
> Trenton D. Adams <trenta <at> athabascau.ca> writes:
> 
> 
>>I thought I read somewhere that JCL allows one to turn on/off debug 
>>logging based on the package or class name.  Is that right?  I'm looking 
>>on the JCL website, but can't find information on that.  Perhaps that's 
>>because I don't know what to search for!
>>
> 
> 
> JCL is simply a "wrapper" that provides a common API to a number of different 
> logging libraries. Configuration of the underlying library is explicitly *not* 
> part of JCL.
> 
> So if you are using log4j as the underlying library then you need to read up on 
> how to configure log4j to turn on/off logging by category name. If you are 
> using native jdk-1.4 logging as the underlying logging library then you need to 
> read up on configuring that, etc.
> 
> Both of the above logging systems *do* have the ability to filter log messages 
> based on log category name (and the recommended convention is for code to use 
> the current class name as the log category).
> 
> Regards,
> 
> Simon
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


-- 
Trenton D. Adams
Web Programmer Analyst
Navy Penguins at your service!
Athabasca University
(780) 675-6195
:wq!

__ 
    This communication is intended for the use of the recipient to whom it
    is addressed, and may contain confidential, personal, and or privileged
    information. Please contact us immediately if you are not the intended
    recipient of this communication, and do not copy, distribute, or take
    action relying on it. Any communications received in error, or
    subsequent reply, should be deleted or destroyed.
---

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


Mime
View raw message