Class NameWrappingLogger
java.lang.Object
java.util.logging.Logger
de.aristaflow.adept2.util.logging.WrappingLogger
de.aristaflow.adept2.util.logging.NameWrappingLogger
A wrapping logger that uses the name filters registered for any handlers of a
wrapped logger and its parent loggers and uses these filters when determining
isLoggable(Level). Additionally, if the filter has a less severe
level than the logger, this wrapping logger simulates the level of the filter
so that the corresponding messages will be logged.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NameFilter[]The name filters of the (parent) handlers of the wrapped logger ornullin case there is no name filter.Fields inherited from class de.aristaflow.adept2.util.logging.WrappingLogger
innerLoggerFields inherited from class java.util.logging.Logger
global, GLOBAL_LOGGER_NAME -
Constructor Summary
ConstructorsConstructorDescriptionNameWrappingLogger(String loggerName, Logger innerLogger, String filterName) Creates a logger specific for the designated names.NameWrappingLogger(Logger innerLogger, String filterName) Creates a logger similar to the designated one except that the filter name is used to check for loggable in case a corresponding name filter is registered for any of the (parent) handlers of the logger. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisLoggable(Level level) Since this method delegates to the inner logger, it usually has to be overridden in case (a subclass of) this logger sets the level without propagating it to the wrapped logger.voidMethods inherited from class de.aristaflow.adept2.util.logging.WrappingLogger
addHandler, equals, getFilter, getHandlers, getLevel, getName, getParent, getResourceBundle, getResourceBundleName, getUseParentHandlers, hashCode, log, removeHandler, setFilter, setLevel, setParent, setUseParentHandlersMethods inherited from class java.util.logging.Logger
config, config, entering, entering, entering, exiting, exiting, fine, fine, finer, finer, finest, finest, getAnonymousLogger, getAnonymousLogger, getGlobal, getLogger, getLogger, info, info, log, log, log, log, log, log, logp, logp, logp, logp, logp, logp, logrb, logrb, logrb, logrb, logrb, logrb, logrb, logrb, setResourceBundle, severe, severe, throwing, warning, warning
-
Field Details
-
filters
The name filters of the (parent) handlers of the wrapped logger ornullin case there is no name filter.
-
-
Constructor Details
-
NameWrappingLogger
Creates a logger similar to the designated one except that the filter name is used to check for loggable in case a corresponding name filter is registered for any of the (parent) handlers of the logger. The name of this logger will be the same as that of the designated logger.
Note that changing the filters or the handlers afterwards will propagate to this logger so the loggable will reflect the behaviour at construction time.- Parameters:
innerLogger- The wrapped logger.filterName- The name which to check for loggable.
-
NameWrappingLogger
Creates a logger specific for the designated names. The filter name is used to check for loggable in case a corresponding name filter is registered for any of the (parent) handlers of the logger. The logger name will be the name of this logger. This may be the same as the name of the designated logger.
Note that changing the filters or the handlers afterwards will propagate to this logger so the loggable will reflect the behaviour at construction time.- Parameters:
loggerName- The name of the wrapping logger. This may be the same as the name of the designated wrapped logger.innerLogger- The wrapped logger.filterName- The name which to check for loggable.
-
-
Method Details
-
setLevel
- Overrides:
setLevelin classWrappingLogger- Throws:
SecurityException
-
isLoggable
Description copied from class:WrappingLoggerSince this method delegates to the inner logger, it usually has to be overridden in case (a subclass of) this logger sets the level without propagating it to the wrapped logger.- Overrides:
isLoggablein classWrappingLogger
-