-
Notifications
You must be signed in to change notification settings - Fork 877
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Logback: don't make MDCPropertyMap of logging event immutable (#12718)
- Loading branch information
Showing
7 changed files
with
96 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
214 changes: 0 additions & 214 deletions
214
...ry/src/main/java/io/opentelemetry/instrumentation/logback/mdc/v1_0/internal/UnionMap.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...library/src/test/java/io/opentelemetry/instrumentation/logback/mdc/v1_0/TestAppender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.logback.mdc.v1_0; | ||
|
||
import ch.qos.logback.classic.spi.ILoggingEvent; | ||
import ch.qos.logback.core.Appender; | ||
import ch.qos.logback.core.UnsynchronizedAppenderBase; | ||
import ch.qos.logback.core.spi.AppenderAttachable; | ||
import ch.qos.logback.core.spi.AppenderAttachableImpl; | ||
import java.util.Iterator; | ||
|
||
public class TestAppender extends UnsynchronizedAppenderBase<ILoggingEvent> | ||
implements AppenderAttachable<ILoggingEvent> { | ||
|
||
static TestAppender instance; | ||
private final AppenderAttachableImpl<ILoggingEvent> aai = new AppenderAttachableImpl<>(); | ||
ILoggingEvent lastEvent; | ||
|
||
public TestAppender() { | ||
instance = this; | ||
} | ||
|
||
private void processEvent(ILoggingEvent event) { | ||
lastEvent = event; | ||
} | ||
|
||
@Override | ||
protected void append(ILoggingEvent event) { | ||
processEvent(event); | ||
aai.appendLoopOnAppenders(event); | ||
} | ||
|
||
@Override | ||
public void addAppender(Appender<ILoggingEvent> appender) { | ||
aai.addAppender(appender); | ||
} | ||
|
||
@Override | ||
public Iterator<Appender<ILoggingEvent>> iteratorForAppenders() { | ||
return aai.iteratorForAppenders(); | ||
} | ||
|
||
@Override | ||
public Appender<ILoggingEvent> getAppender(String name) { | ||
return aai.getAppender(name); | ||
} | ||
|
||
@Override | ||
public boolean isAttached(Appender<ILoggingEvent> appender) { | ||
return aai.isAttached(appender); | ||
} | ||
|
||
@Override | ||
public void detachAndStopAllAppenders() { | ||
aai.detachAndStopAllAppenders(); | ||
} | ||
|
||
@Override | ||
public boolean detachAppender(Appender<ILoggingEvent> appender) { | ||
return aai.detachAppender(appender); | ||
} | ||
|
||
@Override | ||
public boolean detachAppender(String name) { | ||
return aai.detachAppender(name); | ||
} | ||
} |
Oops, something went wrong.