未验证 提交 cd920e27 编写于 作者: M margauxcabrera 提交者: GitHub

Issue#6377 changed slf4j LoggingEvent to apache log4j LoggingEvent (#6378)

Co-authored-by: NMargaux Cabrera <margaux.cabrera@skulibrary.com>
Co-authored-by: wu-sheng's avatar吴晟 Wu Sheng <wu.sheng@foxmail.com>
上级 544bdbec
...@@ -9,8 +9,8 @@ Release Notes. ...@@ -9,8 +9,8 @@ Release Notes.
#### Java Agent #### Java Agent
* Remove invalid mysql configuration in agent.config. * Remove invalid mysql configuration in agent.config.
* Add net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener to show detail message when redefine errors occur * Add net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener to show detail message when redefine errors occur.
* Fix ClassCastException of log4j gRPC reporter.
#### OAP-Backend #### OAP-Backend
* Allow user-defined `JAVA_OPTS` in the startup script. * Allow user-defined `JAVA_OPTS` in the startup script.
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<groupId>log4j</groupId> <groupId>log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
<version>${log4j.version}</version> <version>${log4j.version}</version>
<scope>test</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.skywalking</groupId> <groupId>org.apache.skywalking</groupId>
......
...@@ -35,7 +35,7 @@ import org.apache.skywalking.apm.network.logging.v3.LogDataBody; ...@@ -35,7 +35,7 @@ import org.apache.skywalking.apm.network.logging.v3.LogDataBody;
import org.apache.skywalking.apm.network.logging.v3.LogTags; import org.apache.skywalking.apm.network.logging.v3.LogTags;
import org.apache.skywalking.apm.network.logging.v3.TextLog; import org.apache.skywalking.apm.network.logging.v3.TextLog;
import org.apache.skywalking.apm.network.logging.v3.TraceContext; import org.apache.skywalking.apm.network.logging.v3.TraceContext;
import org.slf4j.event.LoggingEvent; import org.apache.log4j.spi.LoggingEvent;
public class GRPCLogAppenderInterceptor implements InstanceMethodsAroundInterceptor { public class GRPCLogAppenderInterceptor implements InstanceMethodsAroundInterceptor {
...@@ -103,6 +103,8 @@ public class GRPCLogAppenderInterceptor implements InstanceMethodsAroundIntercep ...@@ -103,6 +103,8 @@ public class GRPCLogAppenderInterceptor implements InstanceMethodsAroundIntercep
} }
private String transformLogText(final LoggingEvent event) { private String transformLogText(final LoggingEvent event) {
return event.getMessage() + "\n" + ThrowableTransformer.INSTANCE.convert2String(event.getThrowable(), 2048); final String throwableString = Objects.isNull(event.getThrowableInformation()) ? "" :
ThrowableTransformer.INSTANCE.convert2String(event.getThrowableInformation().getThrowable(), 2048);
return event.getMessage() + "\n" + throwableString;
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册