-
Notifications
You must be signed in to change notification settings - Fork 899
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into deps/1.25.0
- Loading branch information
Showing
7 changed files
with
206 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5154,7 +5154,6 @@ musica.bo | |
musician.io | ||
mutsu.aomori.jp | ||
mutsuzawa.chiba.jp | ||
mutual | ||
mutual.ar | ||
mv | ||
mw | ||
|
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
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,14 @@ | ||
dependencies { | ||
api libs.logback13 | ||
} | ||
|
||
|
||
// Copy common files from logback. | ||
task generateSources(type: Copy) { | ||
from "${rootProject.projectDir}/logback/src/main/java" | ||
into "${project.ext.genSrcDir}/main/java" | ||
exclude "**/LoggingEventWrapper.java" | ||
exclude "**/package-info.java" | ||
} | ||
|
||
tasks.compileJava.dependsOn(generateSources) |
157 changes: 157 additions & 0 deletions
157
logback13/src/main/java/com/linecorp/armeria/common/logback/LoggingEventWrapper.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,157 @@ | ||
/* | ||
* Copyright 2022 LINE Corporation | ||
* | ||
* LINE Corporation licenses this file to you under the Apache License, | ||
* version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package com.linecorp.armeria.common.logback; | ||
|
||
import java.time.Instant; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.slf4j.Marker; | ||
import org.slf4j.event.KeyValuePair; | ||
|
||
import com.linecorp.armeria.common.annotation.Nullable; | ||
|
||
import ch.qos.logback.classic.Level; | ||
import ch.qos.logback.classic.spi.ILoggingEvent; | ||
import ch.qos.logback.classic.spi.IThrowableProxy; | ||
import ch.qos.logback.classic.spi.LoggerContextVO; | ||
import ch.qos.logback.classic.spi.LoggingEvent; | ||
|
||
// TODO(ikhoon): Use `ILoggingEvent` instead of `LoggingEvent` once https://github.com/qos-ch/logback/pull/614 is merged. | ||
final class LoggingEventWrapper extends LoggingEvent { | ||
private final ILoggingEvent event; | ||
private final Map<String, String> mdcPropertyMap; | ||
@Nullable | ||
private final LoggerContextVO vo; | ||
|
||
LoggingEventWrapper(ILoggingEvent event, Map<String, String> mdcPropertyMap) { | ||
this.event = event; | ||
this.mdcPropertyMap = mdcPropertyMap; | ||
|
||
final LoggerContextVO oldVo = event.getLoggerContextVO(); | ||
if (oldVo != null) { | ||
vo = new LoggerContextVO(oldVo.getName(), mdcPropertyMap, oldVo.getBirthTime()); | ||
} else { | ||
vo = null; | ||
} | ||
} | ||
|
||
@Override | ||
public Object[] getArgumentArray() { | ||
return event.getArgumentArray(); | ||
} | ||
|
||
@Override | ||
public Level getLevel() { | ||
return event.getLevel(); | ||
} | ||
|
||
@Override | ||
public String getLoggerName() { | ||
return event.getLoggerName(); | ||
} | ||
|
||
@Override | ||
public String getThreadName() { | ||
return event.getThreadName(); | ||
} | ||
|
||
@Override | ||
public IThrowableProxy getThrowableProxy() { | ||
return event.getThrowableProxy(); | ||
} | ||
|
||
@Override | ||
public void prepareForDeferredProcessing() { | ||
event.prepareForDeferredProcessing(); | ||
} | ||
|
||
@Override | ||
@Nullable | ||
public LoggerContextVO getLoggerContextVO() { | ||
return vo; | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return event.getMessage(); | ||
} | ||
|
||
@Override | ||
public long getTimeStamp() { | ||
return event.getTimeStamp(); | ||
} | ||
|
||
@Override | ||
public Instant getInstant() { | ||
return event.getInstant(); | ||
} | ||
|
||
@Override | ||
public long getSequenceNumber() { | ||
return event.getSequenceNumber(); | ||
} | ||
|
||
@Override | ||
public StackTraceElement[] getCallerData() { | ||
return event.getCallerData(); | ||
} | ||
|
||
@Override | ||
public boolean hasCallerData() { | ||
return event.hasCallerData(); | ||
} | ||
|
||
@Override | ||
public Marker getMarker() { | ||
return event.getMarker(); | ||
} | ||
|
||
@Override | ||
public List<Marker> getMarkerList() { | ||
return event.getMarkerList(); | ||
} | ||
|
||
@Override | ||
public String getFormattedMessage() { | ||
return event.getFormattedMessage(); | ||
} | ||
|
||
@Override | ||
public Map<String, String> getMDCPropertyMap() { | ||
return mdcPropertyMap; | ||
} | ||
|
||
/** | ||
* A synonym for {@link #getMDCPropertyMap}. | ||
* @deprecated Use {@link #getMDCPropertyMap()}. | ||
*/ | ||
@Override | ||
@Deprecated | ||
public Map<String, String> getMdc() { | ||
return event.getMDCPropertyMap(); | ||
} | ||
|
||
@Override | ||
public List<KeyValuePair> getKeyValuePairs() { | ||
return event.getKeyValuePairs(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return event.toString(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
logback13/src/main/java/com/linecorp/armeria/common/logback/package-info.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,26 @@ | ||
/* | ||
* Copyright 2023 LINE Corporation | ||
* | ||
* LINE Corporation licenses this file to you under the Apache License, | ||
* version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/** | ||
* <a href="https://logback.qos.ch/">Logback</a> integration. | ||
* | ||
* <p>Read '<a href="https://armeria.dev/docs/server-basics">Logging contextual information</a>' | ||
* for more information. | ||
*/ | ||
@NonNullByDefault | ||
package com.linecorp.armeria.common.logback; | ||
|
||
import com.linecorp.armeria.common.annotation.NonNullByDefault; |
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