public class Logback11Support extends Object
Encoder
interface was changed from
writing to an OutputStream
to returning byte arrays.
This was a backwards incompatible change, therefore some fancy runtime reflection
is required to make logstash-logback-encoder work with both pre- and post-1.2 logback versions.
This class is used to determine if logback 1.1 is on the runtime classpath (isLogback11OrBefore()
),
and invoke the old methods on the Encoder
interface.Constructor and Description |
---|
Logback11Support() |
Modifier and Type | Method and Description |
---|---|
static void |
close(ch.qos.logback.core.encoder.Encoder<?> encoder)
Invokes the close method of a logback 1.1 encoder.
|
static void |
doEncode(ch.qos.logback.core.encoder.Encoder<?> encoder,
Object event)
Invokes the doEncode method of a logback 1.1 encoder, with the given event as the argument.
|
static void |
init(ch.qos.logback.core.encoder.Encoder<?> encoder,
OutputStream outputStream)
Invokes the init method of a logback 1.1 encoder, with the given outputStream as the argument.
|
static boolean |
isLogback11OrBefore()
Returns true if logback 1.1.x or earlier is on the runtime classpath.
|
static void |
verifyLogback11OrBefore()
Called by logic that should only execute if logback 1.1.x or earlier is on the runtime classpath.
|
static void |
verifyLogback12OrAfter()
Called by logic that should only execute if logback 1.2.x or later is on the runtime classpath.
|
public static boolean isLogback11OrBefore()
public static void verifyLogback11OrBefore()
IllegalStateException
- if the logback version is >= 1.2public static void verifyLogback12OrAfter()
IllegalStateException
- if the logback version is < 1.2public static void init(ch.qos.logback.core.encoder.Encoder<?> encoder, OutputStream outputStream) throws IOException
IOException
public static void doEncode(ch.qos.logback.core.encoder.Encoder<?> encoder, Object event) throws IOException
IOException
public static void close(ch.qos.logback.core.encoder.Encoder<?> encoder) throws IOException
IOException
Copyright © 2018. All rights reserved.