adds support for logback encoders (the message field is encoded). - #794
Conversation
eaa118f to
cafb55b
Compare
adds support for global tags and extras. tags and extras are
distinguished by the existing mdcTags property.
basic usage:
encoders
```
<appender name="jsonSentryAppender" class="io.sentry.logback.SentryAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
<encoder
class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<timestamp />
<version />
<logLevel />
...
...
```
basic usage:
global entries as tags or extras
```
LoggerContext context = (LoggerContext)LoggerFactory.getILoggerFactory();
context.putProperty("global", "value");
```
cafb55b to
0732e4a
Compare
metlos
left a comment
There was a problem hiding this comment.
LGTM, apart from the one nitpick.
| /** | ||
| * Appender encoder. | ||
| */ | ||
| protected Encoder<ILoggingEvent> encoder; |
There was a problem hiding this comment.
Shouldn't this be at least AtomicReference and CAS'd on the use sites so that the unsynchronized access is somewhat handled? Or is it only ever supposed to be mutated by logback during instantiation and before any logging can occur?
There was a problem hiding this comment.
as far as I understand it this isn't an issue. And yes, I think you'd typically create and replace with a new appender than dynamically replace an encoder.
fyi fwiw logstashencoder is doing the same thing:
https://github.com/logstash/logstash-logback-encoder/blob/bbd8333120f274f4d9ef12e797eae2331fed1a52/src/main/java/net/logstash/logback/appender/AbstractLogstashTcpSocketAppender.java#L199
|
Thank you @jeacott1 |
|
should probably add something to the documentation too at some point :) |
|
@jeacott1 would be willing to contribute to: |
|
sure! |
|
Thank you @jeacott1 |
|
please check getsentry/sentry-docs#1379 |
adds support for logback encoders (the message field is encoded)
adds support for global tags and extras (not threadbound). tags and extras are
distinguished by the existing mdcTags property.
basic usage:
encoders
basic usage:
global entries as tags or extras