Logback JSON encoder and appenders
CompositeJsonLayout
(defaults to no line separator for backwards compitability, but can now be configured with a line separator like CompositeJsonEncoder
)Automatic-Module-Name
to logstash.logback.encoder
in MANIFEST.MF
oss-parent
to nexus-staging-maven-plugin
mvnw
for buildingREADME.md
improvementsUsage | Dependency | Old Version | New Version |
---|---|---|---|
Runtime | jackson | 2.9.9.20190807 | 2.10.1 |
Compile-time | maven-jar-plugin | 3.1.2 | 3.2.0 |
Compile-time | maven-source-plugin | 3.1.0 | 3.2.0 |
Compile-time | maven-javadoc-plugin | 3.0.0 | 3.1.1 |
Compile-time | maven-gpg-plugin | n/a | 1.6 |
Compile-time | nexus-staging-maven-plugin | n/a | 1.6.8 |
Test-time | assertj | 3.13.2 | 3.14.0 |
Test-time | mockito | 2.28.2 | 3.2.0 |
writeTimeout
to detect stuck TCP write operations, and reopen the connectiongetConnectionDestination()
to TCP appenders to provide visibility into the currently connected destinationJsonFactoryDecorator
exampleUsage | Dependency | Old Version | New Version |
---|---|---|---|
Runtime | jackson | 2.9.9 | 2.9.9.20190807 |
Compile-time | maven-bundle-plugin | 4.2.0 | 4.2.1 |
Test-time | mockito | 2.27.0 | 2.28.2 |
Test-time | assertj | 2.9.1 | 3.13.2 |
Markers.defer(...)
) are now memoized, so the same value is used when encoding for all appendersOnConsoleStatusListener
to a custom status listener that only outputs warn/error status messages to standard out%marker
is used in patternsVersion 6.0 is a major release with several new features and bugfixes.
Several backwards incompatibilities were introduced (see section below). Most have the ability to revert to previous behavior via config changes if necessary.
Support for Java 1.7 has been removed. Java 1.8 or above is now required.
LogstashUdpSocketAppender
)
Add UDP appender for AccessEvents (LogstashAccessUdpSocketAppender
)
Deprecate LogstashSocketAppender
in favor of LogstashUdpSocketAppender
FailureSummaryLoggingAppenderListener
for logging a message after the first successfully logged event after a series of failuresreconnectionDelay
works, and introducing PreferPrimaryDestinationConnectionStrategy.minConnectionTimeBeforePrimary
omitEmptyFields
)LogstashAccessEncoder
maxLength
Usage | Dependency | Old Version | New Version |
---|---|---|---|
Runtime | jackson | 2.9.8 | 2.9.9 |
Runtime | uuid-generator | 3.1.5 | 3.2.0 |
Runtime (shaded) | commons-lang | 2.6 | n/a |
Runtime (shaded) | commons-lang3 | n/a | 3.9 |
Compile-time | animal-sniffer | 1.17 | 1.18 |
Test-time | mockito | 2.23.4 | 2.27.0 |
Test-time | commons-io | 2.6 | n/a |
Support for Java 1.7 has been removed. Java 1.8 or above is now required.
For #80, LogstashSocketAppender
has been deprecated in favor of LogstashUdpSocketAppender
with a LogstashLayout
For #132, the async appenders (including the tcp appenders) will now add a logback OnConsoleStatusListener
if no status listener has been registered. This provides a better out-of-the-box experience by ensuring error status messages are visible on the console by default.
The automatic registering can be disabled by either registering a different logback status listener or by setting addDefaultStatusListener
to false
on the appender.
For #193, The preferPrimary
connection strategy will now by default ensure a connection has been open for at least 10 seconds before preferring primary again.
If a connection has been open less than 10 seconds, other secondary destinations will be attempted before trying primary again.
To revert to the old behavior of always preferring primary, specify 0 seconds
for the minConnectionTimeBeforePrimary
as documented here
For #274, to support non-JSON output, a new default JsonFactory decorate(JsonFactory factory)
method has been added to the JsonFactoryDecorator
interface.
The old MappingJsonFactory decorate(MappingJsonFactory factory)
method has been made a default
method, and has been deprecated.
The new method is the preferred method of the interface. The old method will be removed in a future release.
Any custom JsonFactoryDecorator
implementations should change their implementation to the new method.
<includeTags>false</includeTags>
(@ramsperger)Logback11Support
class methods were changed from static methods to instance methods to allow for easier unit test mocking. Since this is an internal class, it should not affect end usersUsage | Dependency | Old Version | New Version |
---|---|---|---|
Runtime | jackson | 2.9.6 | 2.9.8 |
Compile-time | maven-compiler-plugin | 2.3.2 | 3.8.0 |
Test-time | mockito | 2.9.0 | 2.23.4 |
Test-time | powermock | 1.7.3 | removed |
logback-core
to provided
scope (@yborovikov)#tryJson
when messages start with a numberSleepingWaitStrategy
's retries
and parkTimeNs
to be configuredSleepingWaitStrategy
.LiteTimeoutBlockingWaitStrategy
Usage | Dependency | Old Version | New Version |
---|---|---|---|
Runtime | jackson | 2.9.5 | 2.9.6 |
Runtime | uuid | 3.1.4 | 3.1.5 |
Runtime (shaded) | disruptor | 3.3.8 | 3.4.2 |
Compile-time | animal-sniffer | 1.16 | 1.17 |
Test-time | assertj | 2.9.0 | 2.9.1 |
Additionally, logback-core
dependency scope was changed from compile
to provided
(#288), and a note was added to the readme indicating that projects that use logstash-logback-encoder must also directly depend on either logback-classic
or logback-access
, which both transitively depend on logback-core
Version 5.0 is a major release with several new features and bugfixes.
Several backwards incompatibilities were introduced (see section below). Most have the ability to revert to previous behavior via config changes if necessary.
Support for Java 1.6 has been removed. Java 1.7 or above is now required.
#tryJson
pattern operation to fall back to just printing the message if the argument is not valid JSONtimestampPattern
configuration property to LogstashEncoder
, LogstashLayout
, LogstashAccessEncoder
, and LogstashAccessLayout
CompositeJsonFactoryDecorator
and CompositeJsonGeneratorDecorator
to make it easier to add multiple decorators.throwableClassName
and throwableRootCauseClassName
JSON providerspattern
JsonProvider to be able to be used within the nestedField
JsonProviderShortenedThrowableConverter
dependencyManagment
to sync logback dependency versionscom.fasterxml.uuid:java-uuid-generator
is no longer included in the logstash-logback-encoder jar, and is now an optional dependencyUsage | Dependency | Old Version | New Version |
---|---|---|---|
Runtime | jackson | 2.8.9 | 2.9.4 |
Runtime (shaded) | disruptor | 3.3.4 | 3.3.8 |
Compile-time | animal-sniffer | 1.15 | 1.16 |
Test-time | assertj | 2.4.0 | 2.9.0 |
Test-time | mockito | 1.10.19 | 2.9.0 |
Test-time | powermock | 1.6.5 | 1.7.3 |
Test-time | commons-io | 2.4 | 2.6 |
Support for Java 1.6 has been removed. Java 1.7 or above is now required.
For #112, the default maxDepthPerThrowable
of the ShortenedThrowableConverter
has been changed to be full/unlimited to be be better aligned with its other configuration parameters.
To revert to the old value, specify 25
for the maxDepthPerThrowable
as documented here
For #138 and #150, access event field names have been changed.
Old field name | New field name |
---|---|
@fields.content_length |
content_length |
@fields.elapsed_time |
elapsed_time |
@fields.method |
method |
@fields.protocol |
protocol |
@fields.requested_url |
requested_url |
@fields.requested_uri |
requested_uri |
@fields.remote_host |
remote_host |
@fields.remote_user |
remote_user |
@fields.status_code |
status_code |
@fields.HOSTNAME |
n/a |
@message |
message |
To revert to the old field names, specify the following in the encoder/layout configuration:
<fieldNames class="net.logstash.logback.fieldnames.Pre50LogstashAccessFieldNames"/>
For #176, the @fields.hostname
field has been removed. It's value was always the same as the @fields.remoteHost
field value (which is now the remoteHost
field)
For #169, the arguments
JSON provider has been enabled by default in the LogstashEncoder
, LogstashLayout
, LogstashAccessEncoder
, and LogstashAccessLayout
To disable the arguments provider, specify the following in the encoder/layout configuration:
<includeStructuredArguments>false</includeStructuredArguments>
For #174, the default field type of the @version
field has changed from an integer to a string.
To change the @version
field type back to an integer, specify the following in the encoder/layout configuration:
<writeVersionAsInteger>true</writeVersionAsInteger>
or, if you are using the version
provider directly, specify the following in the version
provider configuration:
<writeAsInteger>true</writeAsInteger>
For #261 ESCAPE_NON_ASCII
is now disabled by default
To reenable it, you can use the EscapeNonAsciiJsonFactoryDecorator
by specifying the following in the encoder/layout configuration:
<jsonFactoryDecorator class="net.logstash.logback.decorate.EscapeNonAsciiJsonFactoryDecorator"/>
If you were already using a jsonFactoryDecorator, you can use the new CompositeJsonFactoryDecorator
to add multiple JsonFactoryDecorators
Request/response header names are now written in lowercase by default
To revert to the original behavior, specify the following in the encoder/layout/provider configuration:
<lowerCaseHeaderNames>false</lowerCaseHeaderNames>
StackHashJsonProvider
and ShortenedThrowableConverter
)preferPrimary
, roundRobin
, random
)asJson
operator for the pattern json providerHOSTNAME
field was removed from logback context in logback 1.1.10