Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
javalover123888
SkyWalking
提交
7553dff4
S
SkyWalking
项目概览
javalover123888
/
SkyWalking
与 Fork 源项目一致
Fork自
山不在高_有仙则灵 / SkyWalking
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7553dff4
编写于
12月 11, 2016
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
set a new interceptor point for log4j2 to output traceid.
上级
7545ebcc
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
49 addition
and
10 deletion
+49
-10
skywalking-application-toolkit/skywalking-toolkit-log4j-2.x/src/main/java/com/a/eye/skywalking/toolkit/log4j/v2/x/Log4j2OutputAppender.java
...e/skywalking/toolkit/log4j/v2/x/Log4j2OutputAppender.java
+10
-0
skywalking-application-toolkit/skywalking-toolkit-log4j-2.x/src/main/java/com/a/eye/skywalking/toolkit/log4j/v2/x/TraceIdConverter.java
...a/eye/skywalking/toolkit/log4j/v2/x/TraceIdConverter.java
+1
-1
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-log4j-2.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log4j/v2/x/Log4j2OutputAppenderActivation.java
...activation/log4j/v2/x/Log4j2OutputAppenderActivation.java
+31
-0
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-log4j-2.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log4j/v2/x/PrintTraceIdInterceptor.java
...oolkit/activation/log4j/v2/x/PrintTraceIdInterceptor.java
+6
-8
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-log4j-2.x-activation/src/main/resources/skywalking-plugin.def
...j-2.x-activation/src/main/resources/skywalking-plugin.def
+1
-1
未找到文件。
skywalking-application-toolkit/skywalking-toolkit-log4j-2.x/src/main/java/com/a/eye/skywalking/toolkit/log4j/v2/x/Log4j2OutputAppender.java
0 → 100644
浏览文件 @
7553dff4
package
com.a.eye.skywalking.toolkit.log4j.v2.x
;
/**
* Created by wusheng on 2016/12/11.
*/
public
class
Log4j2OutputAppender
{
public
static
void
append
(
StringBuilder
toAppendTo
){
toAppendTo
.
append
(
"TID: N/A"
);
}
}
skywalking-application-toolkit/skywalking-toolkit-log4j-2.x/src/main/java/com/a/eye/skywalking/toolkit/log4j/v2/x/TraceIdConverter.java
浏览文件 @
7553dff4
...
...
@@ -29,6 +29,6 @@ public class TraceIdConverter extends LogEventPatternConverter {
@Override
public
void
format
(
LogEvent
event
,
StringBuilder
toAppendTo
)
{
toAppendTo
.
append
(
"TID: N/A"
);
Log4j2OutputAppender
.
append
(
toAppendTo
);
}
}
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-log4j-2.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log4j/v2/x/
TraceIdConvert
erActivation.java
→
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-log4j-2.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log4j/v2/x/
Log4j2OutputAppend
erActivation.java
浏览文件 @
7553dff4
package
com.a.eye.skywalking.toolkit.activation.log4j.v2.x
;
import
com.a.eye.skywalking.plugin.interceptor.ConstructorInterceptPoint
;
import
com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
com.a.eye.skywalking.plugin.interceptor.MethodMatcher
;
import
com.a.eye.skywalking.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
com.a.eye.skywalking.plugin.interceptor.StaticMethodsInterceptPoint
;
import
com.a.eye.skywalking.plugin.interceptor.enhance.ClassStaticMethodsEnhancePluginDefine
;
import
com.a.eye.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher
;
/**
* Created by wusheng on 2016/12/7.
*/
public
class
TraceIdConverterActivation
extends
ClassInstance
MethodsEnhancePluginDefine
{
public
class
Log4j2OutputAppenderActivation
extends
ClassStatic
MethodsEnhancePluginDefine
{
@Override
protected
String
enhanceClassName
()
{
return
"com.a.eye.skywalking.toolkit.log4j.v2.x.
TraceIdConvert
er"
;
return
"com.a.eye.skywalking.toolkit.log4j.v2.x.
Log4j2OutputAppend
er"
;
}
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
null
;
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]{
new
InstanceMethodsInterceptPoint
()
{
protected
StaticMethodsInterceptPoint
[]
getStaticMethodsInterceptPoints
()
{
return
new
StaticMethodsInterceptPoint
[]{
new
StaticMethodsInterceptPoint
()
{
@Override
public
MethodMatcher
[]
getMethodsMatchers
()
{
return
new
MethodMatcher
[]{
new
SimpleMethodMatcher
(
"
format
"
)};
return
new
MethodMatcher
[]{
new
SimpleMethodMatcher
(
"
append
"
)};
}
@Override
...
...
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-log4j-2.x-activation/src/main/java/com/a/eye/skywalking/toolkit/activation/log4j/v2/x/PrintTraceIdInterceptor.java
浏览文件 @
7553dff4
...
...
@@ -2,16 +2,14 @@ package com.a.eye.skywalking.toolkit.activation.log4j.v2.x;
import
com.a.eye.skywalking.api.Tracing
;
import
com.a.eye.skywalking.plugin.interceptor.EnhancedClassInstanceContext
;
import
com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodInvokeContext
;
import
com.a.eye.skywalking.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
com.a.eye.skywalking.plugin.interceptor.enhance.MethodInterceptResult
;
import
com.a.eye.skywalking.plugin.interceptor.enhance.*
;
/**
* Created by wusheng on 2016/12/7.
*/
public
class
PrintTraceIdInterceptor
implements
Instance
MethodsAroundInterceptor
{
public
class
PrintTraceIdInterceptor
implements
Static
MethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedClassInstanceContext
context
,
Instance
MethodInvokeContext
interceptorContext
,
MethodInterceptResult
result
)
{
public
void
beforeMethod
(
Static
MethodInvokeContext
interceptorContext
,
MethodInterceptResult
result
)
{
((
StringBuilder
)
interceptorContext
.
allArguments
()[
1
]).
append
(
"TID:"
+
Tracing
.
getTraceId
());
//make sure origin method do not invoke.
...
...
@@ -19,12 +17,12 @@ public class PrintTraceIdInterceptor implements InstanceMethodsAroundInterceptor
}
@Override
public
Object
afterMethod
(
EnhancedClassInstanceContext
context
,
Instance
MethodInvokeContext
interceptorContext
,
Object
ret
)
{
return
ret
;
public
Object
afterMethod
(
Static
MethodInvokeContext
interceptorContext
,
Object
ret
)
{
return
null
;
}
@Override
public
void
handleMethodException
(
Throwable
t
,
EnhancedClassInstanceContext
context
,
Instance
MethodInvokeContext
interceptorContext
)
{
public
void
handleMethodException
(
Throwable
t
,
MethodInvokeContext
interceptorContext
)
{
}
}
skywalking-sniffer/skywalking-toolkit-activation/skywalking-toolkit-log4j-2.x-activation/src/main/resources/skywalking-plugin.def
浏览文件 @
7553dff4
com.a.eye.skywalking.toolkit.activation.log4j.v2.x.
TraceIdConvert
erActivation
com.a.eye.skywalking.toolkit.activation.log4j.v2.x.
Log4j2OutputAppend
erActivation
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录