|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbb.util.logging.FilterMsgSuppress
public class FilterMsgSuppress
Filter
implementation which rejects LogRecords if their message contains a known bad substring.
Note that the only state, msgsSuppressed
, is a static field, and therefore shared by all instances.
This behavior was chosen because there was a need, when this class was first written, to have the same substring filter apply to several different Handlers
(the HandlerConsole
and HandlerGui
instances which are usually attached to the root Logger; see this project's logging.properties file for example configuration).
One way that a user can configure this class is via DialogMsgSuppress
.
This class is multithread safe: its only state, msgsSuppressed
, is a multithread safe type.
Field Summary | |
---|---|
private static Set<String> |
msgsSuppressed
Stores all the message substrings which identify messages to be suppressed. |
Constructor Summary | |
---|---|
FilterMsgSuppress()
|
Method Summary | |
---|---|
boolean |
isLoggable(LogRecord record)
First gets record's raw message , that is, before localization or formatting. |
static void |
suppressMsg(String msg)
Adds msg to msgsSuppressed .
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Set<String> msgsSuppressed
Contract: is never null, and must be a multithread safe type.
Constructor Detail |
---|
public FilterMsgSuppress()
Method Detail |
---|
public static void suppressMsg(String msg) throws IllegalArgumentException
msgsSuppressed
.
IllegalArgumentException
- if msg is blank
public boolean isLoggable(LogRecord record) throws IllegalArgumentException
raw message
, that is, before localization or formatting.
Immediately returns true if that message is blank
.
Else, searches thru every element of msgsSuppressed
, returning false if message contains any element as a substring.
isLoggable
in interface Filter
IllegalArgumentException
- if record == null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |