Class LoggerConfig

    • Constructor Detail

      • LoggerConfig

        public LoggerConfig()
        Default constructor.
      • LoggerConfig

        public LoggerConfig​(String name,
                            Level level,
                            boolean additive)
        Constructor that sets the name, level and additive values.
        Parameters:
        name - The Logger name.
        level - The Level.
        additive - true if the Logger is additive, false otherwise.
    • Method Detail

      • getName

        public String getName()
        Returns the name of the LoggerConfig.
        Returns:
        the name of the LoggerConfig.
      • setParent

        public void setParent​(LoggerConfig parent)
        Sets the parent of this LoggerConfig.
        Parameters:
        parent - the parent LoggerConfig.
      • getParent

        public LoggerConfig getParent()
        Returns the parent of this LoggerConfig.
        Returns:
        the LoggerConfig that is the parent of this one.
      • addAppender

        public void addAppender​(Appender appender,
                                Level level,
                                Filter filter)
        Adds an Appender to the LoggerConfig.
        Parameters:
        appender - The Appender to add.
        level - The Level to use.
        filter - A Filter for the Appender reference.
      • removeAppender

        public void removeAppender​(String name)
        Removes the Appender with the specific name.
        Parameters:
        name - The name of the Appender.
      • getAppenders

        public Map<String,​Appender> getAppenders()
        Returns all Appenders as a Map.
        Returns:
        a Map with the Appender name as the key and the Appender as the value.
      • clearAppenders

        protected void clearAppenders()
        Removes all Appenders.
      • getAppenderRefs

        public List<AppenderRef> getAppenderRefs()
        Returns the Appender references.
        Returns:
        a List of all the Appender names attached to this LoggerConfig.
      • setLevel

        public void setLevel​(Level level)
        Sets the logging Level.
        Parameters:
        level - The logging Level.
      • getLevel

        public Level getLevel()
        Returns the logging Level.
        Returns:
        the logging Level.
      • getLogEventFactory

        public LogEventFactory getLogEventFactory()
        Returns the LogEventFactory.
        Returns:
        the LogEventFactory.
      • setLogEventFactory

        public void setLogEventFactory​(LogEventFactory logEventFactory)
        Sets the LogEventFactory. Usually the LogEventFactory will be this LoggerConfig.
        Parameters:
        logEventFactory - the LogEventFactory.
      • isAdditive

        public boolean isAdditive()
        Returns the valid of the additive flag.
        Returns:
        true if the LoggerConfig is additive, false otherwise.
      • setAdditive

        public void setAdditive​(boolean additive)
        Sets the additive setting.
        Parameters:
        additive - true if the LoggerConfig should be additive, false otherwise.
      • isIncludeLocation

        public boolean isIncludeLocation()
        Returns the value of logger configuration attribute includeLocation, or, if no such attribute was configured, true if logging is synchronous or false if logging is asynchronous.
        Returns:
        whether location should be passed downstream
      • getProperties

        @Deprecated
        public Map<Property,​Boolean> getProperties()
        Deprecated.
        use getPropertyList() instead
        Returns an unmodifiable map with the configuration properties, or null if this LoggerConfig does not have any configuration properties.

        For each Property key in the map, the value is true if the property value has a variable that needs to be substituted.

        Returns:
        an unmodifiable map with the configuration properties, or null
        See Also:
        Configuration.getStrSubstitutor(), StrSubstitutor
      • getPropertyList

        public List<Property> getPropertyList()
        Returns an unmodifiable list with the configuration properties, or null if this LoggerConfig does not have any configuration properties.

        Each Property in the list has an attribute valueNeedsLookup that is true if the property value has a variable that needs to be substituted.

        Returns:
        an unmodifiable list with the configuration properties, or null
        Since:
        2.7
        See Also:
        Configuration.getStrSubstitutor(), StrSubstitutor
      • isPropertiesRequireLookup

        public boolean isPropertiesRequireLookup()
      • log

        public void log​(String loggerName,
                        String fqcn,
                        Marker marker,
                        Level level,
                        Message data,
                        Throwable t)
        Logs an event.
        Parameters:
        loggerName - The name of the Logger.
        fqcn - The fully qualified class name of the caller.
        marker - A Marker or null if none is present.
        level - The event Level.
        data - The Message.
        t - A Throwable or null.
      • log

        public void log​(String loggerName,
                        String fqcn,
                        StackTraceElement location,
                        Marker marker,
                        Level level,
                        Message data,
                        Throwable t)
        Logs an event.
        Parameters:
        loggerName - The name of the Logger.
        fqcn - The fully qualified class name of the caller.
        location - the location of the caller.
        marker - A Marker or null if none is present.
        level - The event Level.
        data - The Message.
        t - A Throwable or null.
      • log

        public void log​(LogEvent event)
        Logs an event.
        Parameters:
        event - The log event.
      • log

        protected void log​(LogEvent event,
                           LoggerConfig.LoggerConfigPredicate predicate)
        Logs an event.
        Parameters:
        event - The log event.
        predicate - predicate for which LoggerConfig instances to append to. A null value is equivalent to a true predicate.
      • getReliabilityStrategy

        public ReliabilityStrategy getReliabilityStrategy()
        Returns the object responsible for ensuring log events are delivered to a working appender, even during or after a reconfiguration.
        Returns:
        the object responsible for delivery of log events to the appender
      • callAppenders

        protected void callAppenders​(LogEvent event)
      • includeLocation

        protected static boolean includeLocation​(String includeLocationConfigValue,
                                                 Configuration configuration)
      • hasAppenders

        protected final boolean hasAppenders()