[logback-user] Changing a logger's level for only one appender?

Gerweck Andy - agerwe Andy.Gerweck at acxiom.com
Mon May 21 20:05:26 CEST 2007


Can I take the lack of response as an indication that there's no feature I can use short of an EvaluatorFilter? It seems like the ability to set the threshold for a specific logger and a specific appender is really a valuable one.

If there's no way to do it now, can we agree that this would be a good feature? I would suggest that we choose from:

 1) add a new standard filter, e.g.,
	<filter class="ch.qos.logback.classic.filter.LoggerThresholdFilter">
	  <logger name="com.mchange">
	    <level value="INFO"/>
	  </logger>
	</filter>

 2) add an optional <logger> tag to Threshold Filter, e.g.,
	<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
	  <logger>com.mchange</logger>
	  <level>INFO</level>
	</filter>

 3) allow the logger tag directly inside an appender tag:

	<appender>
	  . . .
	  <logger name="com.mchange">
	    <level value="INFO"/>
	  </logger>
	</appender>


I'm happy to file a bug, or may even find time to create a patch in the next couple of weeks. Does anybody have thoughts or feedback? These proposals are just off the top of my head, so I'm open to other suggestions.

Thanks,
 Andy

> -----Original Message-----
> From: Gerweck Andy - agerwe
> Sent: Wednesday, May 16, 2007 4:04 PM
> To: 'logback users list'
> Subject: RE: [logback-user] Changing a logger's level for only one
> appender?
> 
> Thanks, but this isn't quite enough: I want to set the level for a specific
> logger on a specific appender. E.g., set level to WARN for com.example in
> appender FILE.
> 
> Thanks again,
>  Andy
> 
> -----Original Message-----
> From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On
> Behalf Of dirk ooms
> Sent: Wednesday, May 16, 2007 3:33 PM
> To: logback users list
> Subject: Re: [logback-user] Changing a logger's level for only one
> appender?
> 
> To create a threshold filter inside an appender:
> 
>    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
>      <level>warn</level>
>    </filter>
> 
> hope this helps,
> dirk
> 
> On Thursday 17 May 2007 00:20, Gerweck Andy - agerwe wrote:
> > Hello,
> >
> >
> >
> > I have a couple of applications that create two log files: one with all
> > debug statements for troubleshooting and another with just INFO and
> > above for general information. The debug logs are erased after a day or
> > two while the general log is kept for a month or longer.
> >
> >
> >
> > I apologize if I just missed this in the documentation, but is there an
> > easy way to set the minimum level for a specific logger hierarchy on
> > just a single appender. For example, I want com.example.* to write only
> > WARN and above to my general log, but I still want its DEBUG statements
> > in the debug log. I'm sure I could write my own filter or use an
> > EvaluatorFilter, but this seems like such a common requirement that
> > there would be a standard mechanism.
> >
> >
> >
> > Thanks,
> >   Andy
> >
> >
> >
> >
> ***************************************************************************
> > The information contained in this communication is confidential, is
> > intended only for the use of the recipient named above, and may be
> legally
> > privileged.
> >
> > If the reader of this message is not the intended recipient, you are
> > hereby notified that any dissemination, distribution or copying of this
> > communication is strictly prohibited.
> >
> > If you have received this communication in error, please resend this
> > communication to the sender and delete the original message or any copy
> > of it from your computer system.
> >
> > Thank You.
> >
> ***************************************************************************
> >*
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user


More information about the Logback-user mailing list