I don't think there is a filter for what you want as part of the 1.2.x distribution. We are looking to adding some useful filters for the 1.3 version. One of them will be a Category/Logger filter. If you have any ideas (or submissions!) for other useful filters, we would love to hear about it
-Mark > -----Original Message----- > From: Eric Jain [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, August 14, 2002 2:50 AM > To: log4j-user > Subject: Category filter > > > Did I miss anything or is there in fact no standard way to > restrict logging > by category rather than priority? Perhaps something like the > following code > should be added to the standard distribution? > > > === In log4j.xml <appender> === > > <filter class="CategoryFilter"> > <param name="CategoryName" value="org.test." /> > </filter> > > > === CategoryFilter.java === > > import org.apache.log4j.spi.*; > > public class CategoryFilter > extends Filter > { > private String categoryName; > > public int decide(LoggingEvent event) > { > if (categoryName == null) > return Filter.NEUTRAL; > return event.getLoggerName().startsWith(categoryName) ? > Filter.ACCEPT : Filter.DENY; > } > > public String getCategoryName() > { > return categoryName; > } > > public void setCategoryName(String categoryName) > { > this.categoryName = categoryName; > } > } > > > -- > Eric Jain > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>