Mercurial > repos > timpalpant > java_genomics_toolkit
diff gui/edu/unc/genomics/ThreadFilter.java @ 2:e16016635b2a
Uploaded
author | timpalpant |
---|---|
date | Mon, 13 Feb 2012 22:12:06 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/edu/unc/genomics/ThreadFilter.java Mon Feb 13 22:12:06 2012 -0500 @@ -0,0 +1,35 @@ +package edu.unc.genomics; + +import org.apache.log4j.spi.Filter; +import org.apache.log4j.spi.LoggingEvent; + +/** + * A Log4j filter that filters for messages from a single thread + * @author timpalpant + * + */ +public class ThreadFilter extends Filter { + + private final String threadName; + + public ThreadFilter(String threadName) { + this.threadName = threadName; + } + + @Override + public int decide(LoggingEvent e) { + if(e.getThreadName().equalsIgnoreCase(threadName)) { + return Filter.DENY; + } + + return Filter.NEUTRAL; + } + + /** + * @return the threadName + */ + public String getThreadName() { + return threadName; + } + +}