logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Takacs Bence <be...@watt22.hu>
Subject Re: Different Log4j log file(s) based on Logging Level?
Date Fri, 11 Aug 2006 17:06:20 GMT

According to the documentation you need to make your own MyLevel class 
and extends the original Level. But I haven't done it yet, and don't 
know if it's enough or not and how much additional work you need.


Madduri, Murthy wrote:
>>         <logger name="com.logging.test">
>>
>>                 <!-- Logging level (i.e. WARN) for this logger: -->
>>                 <level value="CONFIG" />
>>
>>                 <!-- File appender for this logger: -->
>>                 <appender-ref ref="fileAppender" />
>>         </logger>
> 
> The appender mentioned in the above example is an appender that writes to a separate
log file (ex, myapp-config.log) file. But, my question is how can I define a custom Level
CONFIG and make it lower than DEBUG? How can I do this in the solution mentioned below: 
> 	>>> First,create a level CONFIG.
> 	>>>make config lower priority than DEBUG, 
> 	>>> add filters to accept only config messages in that appender
> 
> 
> -----Original Message-----
> From: Javier Gonzalez [mailto:jagonzal@gmail.com] 
> Sent: Friday, August 11, 2006 12:33 PM
> To: Log4J Users List
> Subject: Re: Different Log4j log file(s) based on Logging Level?
> 
> On 8/11/06, Madduri, Murthy <Murthy.Madduri@fnf.com> wrote:
>> We have hierarchical logging in our applications.
>> But, this requirement is to have the logs grouped based on a custom
>> level.
>> For a typical configuration transaction, the logger can record messages
>> from various hierarchies. We are not guaranteed of the sequence of
>> messages in this whole transaction. We are pretty much getting all the
>> messages, but, they ended up mixing with other trace statements.
>>
>> For example, if we have a new custom log level, can we use that in
>> <logger> configuration like this?
>>         <logger name="com.logging.test">
>>
>>                 <!-- Logging level (i.e. WARN) for this logger: -->
>>                 <level value="CONFIG" />
>>
>>                 <!-- File appender for this logger: -->
>>                 <appender-ref ref="fileAppender" />
>>         </logger>
> 
> You could, but that (I think) would mean you get all the messages of
> level config and above, unless you make config higher than fatal.
> 
> What you could do is have an appender that is dedicated to these
> config messages, make config lower priority than DEBUG, add filters to
> accept only config messages in that appender, and then set the
> threshold of the other loggers above config. (root logger set at
> config level) That way, the "normal" appenders don't log config, and
> the config appender logs only config.
> 


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


Mime
View raw message