logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Deboy" <Scott.De...@VirtualDesign.Net>
Subject RE: A possible BUG? Logger vs category tag in xml (DOMConfigurator)
Date Tue, 15 Jul 2003 02:25:32 GMT
I believe Chainsaw V2 has a similar requirement - as events are received, the appname and hostname
are examined and events are routed to tabs in the tabbedpane-based UI corresponding to the
unique appname/hostname combination.

For my purposes it was OK to use appender options (see any of the network-based appenders
and the log4japp property in CVS).

In the appender's append(LoggingEvent) method, the property is set on the event if it exists.

So, creating an alternate appender (or using the latest appenders in CVS) may be an alternative
to subclassing if this is all you need.

Scott 


-----Original Message-----
From:	Sanjay Gupta (sanjaygu) [mailto:sanjaygu@cisco.com]
Sent:	Mon 7/14/2003 5:08 PM
To:	'Log4J Users List'
Cc:	
Subject:	RE: A possible BUG?  Logger vs category tag in xml  (DOMConfigurator)
Ok. I considered subclassing. I need to know add few params like,
hostname, applicationID. So I was overriding forcedLog method of Logger
to send myLoggingEvent instead of regular LoggingEvent. MyLoggingEvent
(subclassed from LoggingEvent) has two custom fields - AppId & hostName.

Any thoughts of how I can achieve that?

-Sanjay

-----Original Message-----
From: Ceki Gülcü [mailto:ceki@qos.ch] 
Sent: Monday, July 14, 2003 1:44 PM
To: Log4J Users List
Subject: Re: A possible BUG? Logger vs category tag in xml
(DOMConfigurator)



This subject has been discussed many times in the past. Please refer to
the archives.

No, it is not a bug. Subclassing logger class is discouraged.
Consequently, the logger tag does not allow for a class attribute.
However, you can get around this by various means which I am not going
to disclose here as the means are deprecated, discouraged or both.

I recommend wrapping instead of sub-classing.

At 12:21 PM 7/14/2003 -0700, Sanjay Gupta (sanjaygu) wrote:

>Hi,
>
>I am trying to subclass Logger(Category) & LoggerFactory and use 
>DOMConfigurator(log4j.xml). I ran into interesting problem. My stuff 
>works fine when I configure the logger from program i.e. not using a 
>xml or properties file. But when I use xml file, it turns out that 
><logger> tag does not have a way of specifying class so My subclassed 
>Logger never gets instanciated. I digged deeper and figured out that 
><category> tag has "class" attribute.
>So, now I am confused. Should I subclass Logger or Category. If I
should
>subclass Logger then how can I make sure that my subclassed Logger gets
>instanciated from the log4j.xml and not org.apache.log4j.Logger?
>
>I think that it might be a bug?
>
>Regards,
>-Sanjay

--
Ceki  For log4j documentation consider "The complete log4j manual"
       ISBN: 2970036908  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



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






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


Mime
View raw message