logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: Urgent Help on Logger/Category class subclassing
Date Thu, 20 Jun 2002 13:21:40 GMT
At 17:25 20.06.2002 +0530, Sridharan Vembu wrote:
>Hi Ceki,

Please refrain from naming me when asking questions.

>Two questions here:
>1. Its been stressed on many instances that subclassing of Logger/category 
>class is strongly discouraged. Could you have any specific reasons for that.

This is an excerpt from "the complete log4j manual":

The actual implementation of the Logger class in use depends on the
LoggerRe-pository in use in a given context as determined by the
RepositorySelector. For example, it is entirely possible for two
web-applications to use different logger repositories (hierarchies)
that return different Logger implementations in response to the
invocation of their getLogger() method. The ability to impose the
Logger implementation is the reserved privilege of Servlet container
or EJB container developers, not casual users. Ignoring this
restriction is likely to cause trouble in future versions of J2EE
containers that closely integrate with log4j. For more details on the
RepositorySelector see the section entitled "The Wider Picture" in
Chapter 8.

>Why I'm asking is, we are forced to subclass the Logger class for our 
>requirement where we need to set the file name dynamically. And we are 
>doing it with overriding addAppender method of Logger class.In this 
>regard, it would be better for us, if you suggest some means to go about, 
>in the fact of subclassing is discouraged.

Why can't you dynamically set the file name of your appender 
(FilleAppender?) somewhere else?

>2. We are using log4jv1.2rc1 in our project. And in the xml configuration 
>file, we are using the param option for the Category element which is not 
>there for the Logger element. In this scenario, whether the current 
>release of log4j, i.e.1.2.4 accounts for this in the Logger element(I have 
>yet to download the latest version), so that migration to 1.2.4 from 1.2 
>wont affect our current design of processing the param option inside the 
>Category/Logger subclass.

No changes there.

>Your earliest response would help us a lot.
>Thanks & Regards


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

View raw message