You can set a on Filter a Logger . A Filter can filter out log messages, meaning decide if the message gets logged or not. Filters is represented by the Java interfacejava.util.logging.Filter
Example of setting a on Filter a Logger :
Filter filter = new Myfilter (); Logger1.setfilter (filter);
The Filter interface is defined like this:
Public interface Filter {public boolean isloggable (LogRecord record);}
If isLoggable() The method returns False, the is not LogRecord logged. If The method returns True, the is LogRecord forwarded to the Handler ' s of the given Logger .
To create a you Filter must implement that interface. Here are a very simple example implementation:
public class Myfilter implements Filter {public boolean isloggable (LogRecord record) { return false; }}
This filter rejects the all messages. Of course a very useful filter. You would probably inspect the and make LogRecord a decision based on that. You can learn more about LogRecord the the the text on the LogRecord, and the JavaDoc too.
For a discussion of what Filter ' s work within Logger the hierarchy, see the text on the Logger hierarchy.
Java logging:filters