Skip to content

Commit

Permalink
allow MDCAdapter to to be overriden in LogbackContext.setMDCAdapter
Browse files Browse the repository at this point in the history
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
  • Loading branch information
ceki committed Feb 23, 2024
1 parent 4eaefeb commit 097da9d
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,10 @@ public MDCAdapter getMDCAdapter() {
}

public void setMDCAdapter(MDCAdapter anAdapter) {
if(this.mdcAdapter == null) {
this.mdcAdapter = anAdapter;
} else {
if(this.mdcAdapter != null) {
StatusManager sm = getStatusManager();
sm.add(new ErrorStatus("mdcAdapter cannot be set multiple times", this, new IllegalStateException("mdcAdapter already set")));
sm.add(new WarnStatus("mdcAdapter being reset a second time", this));
}
this.mdcAdapter = anAdapter;
}
}

0 comments on commit 097da9d

Please sign in to comment.