Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1341

(GC) Avoid allocating temporary objects in Pattern Converters for PatternLayout

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.5
    • Fix Version/s: None
    • Component/s: Pattern Converters
    • Labels:
      None

      Description

      To do
      The following pattern converters can be modified to avoid creating temporary objects in their format method:

      • all done

      Investigate
      The following pattern converters may be difficult to modify since they rely on JDK components that create temporary objects:

      • ExtendedThrowablePatternConverter
      • RegexReplacementConverter
      • RootThrowablePatternConverter
      • ThrowablePatternConverter
      • UuidPatternConverter
      • ClassNamePatternConverter (location information requires creating StackTraceElements)
      • FileLocationPatternConverter
      • FullLocationPatternConverter
      • LineLocationPatternConverter
      • MethodLocationPatternConverter

      Done
      The following pattern converters already do not allocate temporary objects in their format method:

      • AbstractStyleNameConverter (since 2.8)
      • HighlightConverter (since 2.7, thanks to Richard Zschech)
      • StyleConverter (since 2.7, thanks to Richard Zschech)
      • DatePatternConverter
      • EqualsIgnoreCaseReplacementConverter (since 2.8)
      • EqualsReplacementConverter (since 2.8)
      • EncodingPatternConverter (since 2.8)
      • IntegerPatternConverter (since 2.8)
      • LevelPatternConverter
      • LineSeparatorPatternConverter
      • LiteralPatternConverter (unless literal contains '${')
      • LoggerPatternConverter
      • MapPatternConverter (since 2.8 - note that constructing a MapMessage is not garbage-free)
      • MarkerPatternConverter (since 2.8)
      • MarkerSimpleNamePatternConverter
      • MaxLengthConverter (since 2.8)
      • MdcPatternConverter (since 2.7)
      • MessagePatternConverter (unless a Jansi or HTML renderer is configured or message has '${' lookups)
      • NamePatternConverter
      • NanoTimePatternConverter
      • NdcPatternConverter (since 2.8 ContextStack implementations implement the StringBuilderFormattable interface - note that the ThreadContext stack is cloned for each log event and is not garbage-free)
      • RelativeTimePatternConverter (since 2.8)
      • SequenceNumberPatternConverter (since 2.8)
      • ThreadIdPatternConverter
      • ThreadNamePatternConverter
      • ThreadPriorityPatternConverter
      • VariablesNotEmptyReplacementConverter (since 2.8)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                remkop@yahoo.com Remko Popma
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated: