Class NameWrappingLogger


  • public class NameWrappingLogger
    extends WrappingLogger
    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 Detail

      • filters

        protected NameFilter[] filters
        The name filters of the (parent) handlers of the wrapped logger or null in case there is no name filter.
    • Constructor Detail

      • NameWrappingLogger

        public 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. 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

        public NameWrappingLogger​(String loggerName,
                                  Logger innerLogger,
                                  String filterName)
        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.