github logfellow/logstash-logback-encoder logstash-logback-encoder-7.1

Bug Fixes

  • #747/#748 Logger name shortening down to the class name (length set to zero). (@brenuart)

    When using a LogstashEncoder, the <shortenedLoggerNameLength> configuration property can be used to shorten the logger name as described in here. This feature is supposed to behave the same as the standard Logback length conversion word. However, although the logger name was properly shortened when the desired length was greater than zero, it did not produce the expected result when the length was set to 0. In fact, foo.bar.baz.MyClass was shortened to f.b.b.MyClass instead of MyClass.

  • #765 PatternJsonProvider: omitEmptyFields doesn't work with %property{key}. (@brenuart)

    The Logback %property{key} conversion specifier returns null when the property does not exists. This value is added as-is to the String evaluation of the pattern which ultimately gives the string "null" (in letters) that won't be filtered out by the omitEmptyField feature.
    To solve this issue, the PatternJsonProvider now uses a custom %property{key} converter that returns an empty string instead of null when the property does not exist. It also allows you to specify a default value to use when the property does not exist. People wanting to revert to the old behaviour can explicitly set the default value to "null" like this %property{key:-null}.

  • #751 Fixed wrong link in README.md for #event-specific-custom-fields (@mightymoogle)

Enhancements

  • #711 Fast Timestamp Format (@brenuart)

    The *FormattedTimestampJsonProvider are now faster than ever thanks to the introduction of a new FastISOTimestampFormat.

    This new formatter leverages the fact that in a logging scenario timestamps are mostly formatted in chronological order.
    Instead of computing every date/time fields like the standard DateTimeFormatter does each time it is invoked, the fast formatter remembers the previous formatted value and replaces the second and millis parts when the next timestamp to format is within the same minute. This strategy is 7x faster and produces 10x less garbage compared to the DateTimeFormatter.

    The "fast" formatter is used only when the provider is configured with one of the following standard ISO formats (obtained from the Java DateTimeFormatter). A standard DateTimeFormatter is used for the other standard formats or if a custom pattern is configured (even if the pattern matches one of the supported ISO formats).

    • ISO_OFFSET_DATE_TIME
    • ISO_ZONED_DATE_TIME
    • ISO_LOCAL_DATE_TIME
    • ISO_DATE_TIME
    • ISO_INSTANT
  • #772 PatternJsonProvider: support for default value in %property{key} (@brenuart)

    The %property{key} conversion specifier used by the PatternJsonProvider has been enhanced to add support for a default value to use when the property does not exist. The default value is optional and can be specified using the :- operator as in Bash shell. For example, assuming the property "foo" is not defined, %property{foo:-bar} will return bar.
    If no optional value is declared, the converter returns an empty string instead of null as does the original Logback version.
    Check the relevant section of the documentation for more information.

  • #743 Add new JsonProviders for exception messages (@twz123)

  • #773/#774 PatternJsonProvider: provide a "#asNullIfEmpty{}" operation (@brenuart)

  • #719/#720 getFieldValue() should return fieldValue without transforming it into a String (@brenuart)

  • #728 Custom JsonGenerator with optimized writeObject() for simple object types (@brenuart)

Project Improvements

  • #709 "no-response" bot not working anymore since the project was moved to the "logfellow" organisation (@philsttr)
  • #777 Upgraded maven 3.8.5 and maven wrapper (@philsttr)
  • #766/#786 Update license header template to match year 2022 (@brenuart)

Dependency version changes

Usage Dependency Old Version New Version
Runtime jackson 2.13.0 2.13.2.20220328
Runtime logback 1.2.7 1.2.11
Compile-time checkstyle 9.1 9.2.1
Compile-time animal-sniffer-maven-plugin 1.20 1.21
Compile-time maven-bundle-plugin 5.1.2 5.1.4
Compile-time maven-clean-plugin 3.1.0 3.2.0
Compile-time maven-compiler-plugin 3.8.1 3.10.0
Compile-time maven-jar-plugin 3.2.0 3.2.2
Compile-time maven-javadoc-plugin 3.3.1 3.3.2
Compile-time maven-shade-plugin 3.2.4 3.3.0
Compile-time nexus-staging-maven-plugin 1.6.8 1.6.12
Test-time assertj 3.21.0 3.22.0
Test-time awaitility 4.1.1 4.2.0
Test-time junit 5.8.1 5.8.2
Test-time mockito 4.0.0 4.4.0

Don't miss a new logstash-logback-encoder release

NewReleases is sending notifications on new releases.