Package log

Class Log4jDevelopmentPatternConverter

  • All Implemented Interfaces:
    org.apache.logging.log4j.core.pattern.PatternConverter

    @Plugin(name="DevPatternConverter",
            category="Converter")
    public class Log4jDevelopmentPatternConverter
    extends org.apache.logging.log4j.core.pattern.LogEventPatternConverter
    Pattern converter for Log4j 2.x that adds a hyperlink for the calling class of the current log message. This is to be used in log4j configurations as part of a pattern layout. eg: <PatternLayout pattern="%-5p %m %hl %n"/> See generic.log4jdev.xml for a working example.
    • Field Summary

      • Fields inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter

        LOGGER
      • Fields inherited from interface org.apache.logging.log4j.core.pattern.PatternConverter

        CATEGORY
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Log4jDevelopmentPatternConverter​(java.lang.String name, java.lang.String style)
      Required constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void format​(org.apache.logging.log4j.core.LogEvent event, java.lang.StringBuilder toAppendTo)
      Appends the desired hyperlink to the existing event message.
      static Log4jDevelopmentPatternConverter newInstance​(java.lang.String[] options)
      Required instance method for all log4j 2.x converters.
      • Methods inherited from class org.apache.logging.log4j.core.pattern.LogEventPatternConverter

        format, handlesThrowable, isVariable
      • Methods inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter

        getName, getStyleClass
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Log4jDevelopmentPatternConverter

        protected Log4jDevelopmentPatternConverter​(java.lang.String name,
                                                   java.lang.String style)
        Required constructor.
        Parameters:
        name - the name of the converter
        style - the style of the converter
    • Method Detail

      • newInstance

        public static Log4jDevelopmentPatternConverter newInstance​(java.lang.String[] options)
        Required instance method for all log4j 2.x converters.
        Parameters:
        options - unused
        Returns:
        new converter instance
      • format

        public void format​(org.apache.logging.log4j.core.LogEvent event,
                           java.lang.StringBuilder toAppendTo)
        Appends the desired hyperlink to the existing event message.
        Specified by:
        format in class org.apache.logging.log4j.core.pattern.LogEventPatternConverter
        Parameters:
        event - the current log event
        toAppendTo - the string to append to