├── .coveralls.yml
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── LICENSE.txt
├── README.md
├── auto-log-annotation
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── github
│ └── houbb
│ └── auto
│ └── log
│ ├── annotation
│ └── AutoLog.java
│ ├── api
│ ├── IAutoLog.java
│ ├── IAutoLogContext.java
│ ├── IAutoLogObjectHandler.java
│ ├── IAutoLogSampleCondition.java
│ ├── IParamFilter.java
│ └── IParamFilterContext.java
│ └── exception
│ └── AutoLogRuntimeException.java
├── auto-log-core-extra
├── pom.xml
└── src
│ └── main
│ └── java
│ └── org
│ └── springframework
│ ├── core
│ └── io
│ │ └── InputStreamSource.java
│ └── web
│ └── multipart
│ └── MultipartFile.java
├── auto-log-core
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── github
│ │ └── houbb
│ │ └── auto
│ │ └── log
│ │ └── core
│ │ ├── bs
│ │ └── AutoLogBs.java
│ │ ├── constant
│ │ └── AutoLogAttachmentKeyConst.java
│ │ ├── core
│ │ ├── impl
│ │ │ ├── AbstractAutoLogContext.java
│ │ │ ├── SimpleAutoLog.java
│ │ │ └── SimpleAutoLogContext.java
│ │ └── package-info.java
│ │ ├── exception
│ │ └── AutoLogException.java
│ │ ├── package-info.java
│ │ └── support
│ │ ├── filter
│ │ ├── package-info.java
│ │ └── param
│ │ │ ├── AbstractParamFilter.java
│ │ │ ├── ParamFilterContext.java
│ │ │ └── WebParamFilter.java
│ │ ├── handler
│ │ ├── AbstractAutoLogObjectHandler.java
│ │ ├── AutoLogObjectHandlerBigMemoryDiscard.java
│ │ ├── AutoLogObjectHandlerDubboResult.java
│ │ ├── AutoLogObjectHandlerInit.java
│ │ ├── AutoLogObjectHandlerRaw.java
│ │ ├── AutoLogObjectHandlerWebDiscard.java
│ │ └── AutoLogObjectHandlers.java
│ │ ├── interceptor
│ │ ├── AutoLogMethodInterceptor.java
│ │ ├── cache
│ │ │ └── AutoLogCacheInterceptor.java
│ │ ├── chain
│ │ │ ├── AutoLogCommonFilter.java
│ │ │ ├── AutoLogFilterChainConst.java
│ │ │ ├── AutoLogInvocation.java
│ │ │ └── AutoLogInvoker.java
│ │ ├── common
│ │ │ ├── AbstractAutoLogCommonFilter.java
│ │ │ ├── AutoLogCommonFilterContext.java
│ │ │ └── AutoLogCommonGlobalAnnotation.java
│ │ ├── dubbo
│ │ │ ├── AbstractAutoLogDubboFilter.java
│ │ │ ├── AutoLogDubboConsumerFilter.java
│ │ │ ├── AutoLogDubboContext.java
│ │ │ └── AutoLogDubboProviderFilter.java
│ │ ├── jms
│ │ │ ├── AutoLogJmsConsumerInterceptor.java
│ │ │ └── AutoLogJmsProducerInterceptor.java
│ │ ├── schedule
│ │ │ └── AutoLogScheduleInterceptor.java
│ │ └── web
│ │ │ ├── client
│ │ │ └── AutoLogHttpClientInterceptor.java
│ │ │ ├── package-info.java
│ │ │ └── server
│ │ │ └── AutoLogHttpServerServletFilter.java
│ │ ├── package-info.java
│ │ ├── proxy
│ │ ├── AutoLogProxy.java
│ │ ├── IAutoLogProxy.java
│ │ ├── cglib
│ │ │ └── CglibProxy.java
│ │ ├── dynamic
│ │ │ ├── DynamicProxy.java
│ │ │ └── package-info.java
│ │ ├── none
│ │ │ └── NoneProxy.java
│ │ └── package-info.java
│ │ └── sample
│ │ ├── AutoLogSampleConditionAdaptive.java
│ │ ├── AutoLogSampleConditionAdaptiveSchedule.java
│ │ ├── AutoLogSampleConditionRate.java
│ │ ├── AutoLogSampleConditions.java
│ │ └── InnerRandomUtil.java
│ └── resources
│ └── META-INF
│ ├── dubbo
│ └── com.alibaba.dubbo.rpc.Filter
│ └── services
│ └── com.github.houbb.common.filter.api.CommonFilter
├── auto-log-spring
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── github
│ └── houbb
│ └── auto
│ └── log
│ └── spring
│ ├── annotation
│ └── EnableAutoLog.java
│ ├── aop
│ ├── AutoLogAdvice.java
│ ├── AutoLogAdviceContext.java
│ ├── AutoLogAop.java
│ └── AutoLogDynamicPointcut.java
│ ├── config
│ ├── AutoLogAopConfig.java
│ └── DefaultAutoLogGlobalConfig.java
│ ├── context
│ └── SpringAopAutoLogContext.java
│ └── package-info.java
├── auto-log-springboot-starter
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── github
│ │ └── houbb
│ │ └── auto
│ │ └── log
│ │ └── springboot
│ │ └── starter
│ │ ├── config
│ │ └── AutoLogAutoConfig.java
│ │ └── package-info.java
│ └── resources
│ └── META-INF
│ └── spring.factories
├── auto-log-test
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── github
│ │ │ └── houbb
│ │ │ └── auto
│ │ │ └── log
│ │ │ └── test
│ │ │ ├── config
│ │ │ └── SpringConfig.java
│ │ │ ├── dynamic
│ │ │ ├── SpringDynamicConfig.java
│ │ │ └── service
│ │ │ │ ├── MyAddressService.java
│ │ │ │ └── MyUserService.java
│ │ │ ├── filter
│ │ │ └── MyParamFilter.java
│ │ │ ├── interceptor
│ │ │ └── MyAutoLogInterceptor.java
│ │ │ ├── package-info.java
│ │ │ └── service
│ │ │ ├── DiscardService.java
│ │ │ ├── UserService.java
│ │ │ ├── annotation
│ │ │ └── AutoLogMethod.java
│ │ │ └── impl
│ │ │ ├── ClassAnnotationService.java
│ │ │ ├── DefineService.java
│ │ │ ├── MenuServiceImpl.java
│ │ │ ├── MethodAtServiceImpl.java
│ │ │ ├── PrivateUserServiceImpl.java
│ │ │ ├── SampleRateServiceImpl.java
│ │ │ └── UserServiceImpl.java
│ └── resources
│ │ ├── autoLogConfig.properties
│ │ └── log4j2.xml
│ └── test
│ ├── java
│ └── com
│ │ └── github
│ │ └── houbb
│ │ └── auto
│ │ └── log
│ │ ├── core
│ │ └── bs
│ │ │ ├── AutoLogBsRateTest.java
│ │ │ ├── AutoLogBsTest.java
│ │ │ ├── AutoLogCoreDiscardTest.java
│ │ │ └── package-info.java
│ │ ├── dynamic
│ │ └── SpringDynamicServiceTest.java
│ │ └── spring
│ │ ├── SpringPrivateServiceTest.java
│ │ ├── SpringServiceMethodTest.java
│ │ └── SpringServiceTest.java
│ └── resources
│ └── META-INF
│ └── services
│ └── com.github.houbb.common.filter.api.CommonFilter
├── cgit.bat
├── cgit.sh
├── doc
├── 02-dynamic-pointcut.md
├── CI集成.md
├── issues
│ └── 个人思考.md
├── user
│ └── 01-项目模块.md
├── 发布流程.md
└── 版本迭代规范.md
├── github_init.bat
├── pom.xml
├── release.bat
├── release.sh
└── release_rm.sh
/.coveralls.yml:
--------------------------------------------------------------------------------
1 | service_name: travis-ci
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # maven ignore
2 | target/
3 | *.jar
4 | *.war
5 | *.zip
6 | *.tar
7 | *.tar.gz
8 |
9 | # eclipse ignore
10 | .settings/
11 | .project
12 | .classpath
13 |
14 | # idea ignore
15 | .idea/
16 | *.ipr
17 | *.iml
18 | *.iws
19 |
20 | # temp ignore
21 | *.log
22 | *.cache
23 | *.diff
24 | *.patch
25 | *.tmp
26 | *.java~
27 | *.properties~
28 | *.xml~
29 |
30 | # system ignore
31 | .DS_Store
32 | Thumbs.db
33 |
34 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | jdk:
3 | - openjdk8
4 | install: mvn install -DskipTests=true -Dmaven.javadoc.skip=true
5 | script: mvn test
6 | after_success:
7 | - mvn clean cobertura:cobertura coveralls:report
8 |
9 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 变更日志
2 |
3 | | 类型 | 说明 |
4 | |:----|:----|
5 | | A | 新增 |
6 | | U | 更新 |
7 | | D | 删除 |
8 | | T | 测试 |
9 | | O | 优化 |
10 | | F | 修复BUG |
11 |
12 | # release_0.0.1
13 |
14 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
15 | |:---|:---|:---|:---|:--|
16 | | 1 | A | 基本的特性实现 | 2020-5-25 13:43:05 | |
17 |
18 | # release_0.0.2
19 |
20 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
21 | |:---|:---|:---|:---|:--|
22 | | 1 | A | 支持声明式的代理实现 | 2020-5-29 16:25:32 | |
23 |
24 | # release_0.0.3
25 |
26 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
27 | |:---|:---|:---|:---|:--|
28 | | 1 | A | 整合 spring 实现 | 2020-5-30 12:28:05 | |
29 |
30 | # release_0.0.4
31 |
32 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
33 | |:---|:---|:---|:---|:--|
34 | | 1 | A | 新增慢日志阈值特性 | 2020-6-1 16:45:14 | |
35 | | 2 | O | 代理部分使用 aop 共有模块 | 2020-6-1 16:49:00 | |
36 |
37 | # release_0.0.5
38 |
39 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
40 | |:---|:---|:---|:---|:--|
41 | | 1 | A | spring-boot 整合实现 | 2020-8-6 09:47:19 | |
42 |
43 | # release_0.0.6
44 |
45 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
46 | |:---|:---|:---|:---|:--|
47 | | 1 | A | 添加非接口的支持 | 2020-9-2 21:55:25 | |
48 |
49 | # release_0.0.7
50 |
51 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
52 | |:---|:---|:---|:---|:--|
53 | | 1 | A | 添加 description 特性 | 2020-9-6 10:13:09 | |
54 | | 2 | O | 优化日志实现 | 2020-9-6 10:13:09 | |
55 |
56 | # release_0.0.8
57 |
58 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
59 | |:---|:---|:---|:---|:--|
60 | | 1 | A | 添加 traceId 特性 | 2020-9-6 21:37:43 | |
61 |
62 | # release_0.0.9
63 |
64 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
65 | |:---|:---|:---|:---|:--|
66 | | 1 | A | 添加支持自定义日志策略 | 2020-9-25 21:37:43 | |
67 |
68 | # release_0.0.10
69 |
70 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
71 | |:---|:---|:---|:---|:--|
72 | | 1 | A | 支持类级别自定义注解 | 2020-9-25 21:37:43 | |
73 | | 2 | A | 使用拦截器替代 v0.0.9 的实现方式 | 2020-9-25 21:37:43 | |
74 | | 3 | O | 使用 fastJson 替代原来的 toString() | 2020-9-25 21:37:43 | |
75 |
76 | # release_0.0.11
77 |
78 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
79 | |:---|:---|:---|:---|:--|
80 | | 1 | F | 添加 HttpRequest/HttpResponse 等参数的过滤 | 2020-9-25 21:37:43 | |
81 |
82 | # release_0.0.12
83 |
84 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
85 | |:---|:---|:---|:---|:--|
86 | | 1 | A | 支持入参指定 Filter 特性 | 2020-9-26 10:01:11 | |
87 |
88 | # release_0.0.13
89 |
90 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
91 | |:---|:---|:---|:---|:--|
92 | | 1 | A | 调整 WebParamFilter 为默认过滤策略 | 2020-9-26 16:01:15 | |
93 | | 2 | O | 使用类替代原来的接口判断方式 | 2020-9-26 16:01:15 | |
94 |
95 | # release_0.0.14
96 |
97 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
98 | |:---|:---|:---|:---|:--|
99 | | 1 | A | 将 AutoLogUtil 提取为单独的工具类,便于获取 traceId | 2020-9-26 16:01:15 | |
100 |
101 | # release_0.0.15
102 |
103 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
104 | |:---|:---|:---|:---|:--|
105 | | 1 | A | 添加文件信息的过滤 | 2021-9-20 16:01:15 | |
106 |
107 | # release_0.0.16
108 |
109 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
110 | |:---|:---|:---|:---|:--|
111 | | 1 | A | 简化操作日志,移除 @TraceId | 2022-12-20 16:01:15 | |
112 |
113 | # release_0.1.0
114 |
115 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
116 | |:---|:---|:---|:---|:--|
117 | | 1 | A | 更新 heaven/fastjson 版本依赖 | 2023-03-22 16:01:15 | |
118 |
119 | # release_0.2.0
120 |
121 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
122 | |:---|:---|:--------------|:--------------------|:--|
123 | | 1 | A | 附加包独立, 便于单独排除 | 2023-07-20 16:01:15 | |
124 |
125 | # release_0.3.0
126 |
127 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
128 | |:---|:---|:----------------|:--------------------|:--|
129 | | 1 | A | 支持 pointcut 自定义 | 2023-07-21 16:01:15 | |
130 |
131 | # release_0.4.0
132 |
133 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
134 | |:---|:-----|:-----------------------|:--------------------|:--|
135 | | 1 | A | 使用 dubbo chain 模式实现拦截器 | 2023-08-06 16:01:15 | |
136 | | 2 | O | 优化日志格式 | 2023-08-06 16:01:15 | |
137 |
138 | # release_0.5.0
139 |
140 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
141 | |:---|:-----|:-----------------------|:--------------------|:--|
142 | | 1 | A | 新增采样条件,指定比例采样 | 2023-08-18 16:01:15 | |
143 |
144 | # release_0.6.0
145 |
146 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
147 | |:---|:-----|:-----------------------|:--------------------|:--|
148 | | 1 | A | 新增自适应采样 | 2023-08-20 16:01:15 | |
149 |
150 | # release_0.7.0
151 |
152 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
153 | |:---|:-----|:-------------|:--------------------|:--|
154 | | 1 | A | 添加 dubbo 拦截器 | 2023-09-18 16:01:15 | |
155 |
156 | # release_0.8.0
157 |
158 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
159 | |:---|:-----|:-------------|:--------------------|:--|
160 | | 1 | A | 添加 log4j2 默认日志依赖 | 2023-09-27 16:01:15 | |
161 | | 2 | O | 优化 filter,调整 dubbo 位置 | 2023-09-27 16:01:15 | |
162 |
163 | # release_0.9.0
164 |
165 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
166 | |:---|:-----|:-------------|:--------------------|:--|
167 | | 1 | A | 添加统一的 filter | 2023-09-27 16:01:15 | |
168 |
169 | # release_0.10.0
170 |
171 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
172 | |:---|:-----|:--------------------------------|:--------------------|:--|
173 | | 1 | A | 添加 result filter | 2023-09-27 16:01:15 | |
174 | | 2 | A | 添加 param filter bigdata discard | 2023-09-27 16:01:15 | |
175 |
176 | # release_0.11.0
177 |
178 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
179 | |:---|:-----|:--------------------------------|:--------------------|:--|
180 | | 1 | A | 添加定长截断 | 2023-10-10 16:01:15 | |
181 | | 2 | O | 优化丢弃策略 | 2023-10-10 16:01:15 | |
182 |
183 | # release_0.12.0
184 |
185 | | 序号 | 变更类型 | 说明 | 时间 | 备注 |
186 | |:---|:-----|:-------------|:--------------------|:--|
187 | | 1 | O | 移除 log4j2 依赖 | 2024-01-29 16:01:15 | |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright 2016 ShenHuaJie iBase4J@163.com
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
204 | ======================================================================
205 |
206 | Apache许可证
207 | 版本 2.0,2004年1月
208 | http://www.apache.org/licenses/
209 |
210 | 使用、重生成及分发的术语和条件:
211 |
212 | 1.定义
213 |
214 | "许可证"是指根据本文档第1到第9部分关于使用、重生成和分发的术语和条件。
215 |
216 | "许可证颁发者"是指版权所有者或者由版权所有者批准的授权许可证的实体。
217 |
218 | "法律实体"是指实施实体和进行控制的所有其它实体受该实体控制,或者受该实体集中控制。
219 | 根据此定义,"控制"是指(i)让无论是否签订协议的上述实体,进行指导或管理的直接权利或间接权利,
220 | 或者(ii)拥有百分之五十(50%)或以上已发行股票的所有者,或者(iii)上述实体的实权所有者。
221 |
222 | "用户"(或"用户的")是指行使本许可证所授予权限的个人或法律实体。
223 |
224 | "源程序"形式是指对包含但不限制软件源代码、文档源程序和配置文件进行修改的首选形式。
225 |
226 | "目标"形式是指对源程序形式进行机械转换或翻译的任何形式,包括但不限于对编译的目标代码,
227 | 生成的文件以及转换为其它媒体类型。
228 |
229 | "作品"是指根据本许可证所制作的源程序形式或目标形式的著作,在著作中包含的或附加的版权通知
230 | (在下面附录中提供了一个示例)。
231 |
232 | "衍生作品"是指基于作品(或从作品衍生而来)的源程序形式或目标形式的任何作品,以及编辑修订、
233 | 注释、详细描述或其它修订等构成原创著作作品的整体。根据本许可证,衍生作品不得包括与作品及其
234 | 衍生作品分离之作品,或仅与作品及其衍生作品的接口相链接(或按名称结合)之作品。
235 |
236 | "贡献"是指任何著作作品,包括作品的原始版本和对该作品或衍生作品所做的任何修订或补充,
237 | 意在提交给许可证颁发者以让版权所有者或代表版权所有者的授权个人或法律实体包含在其作品中。
238 | 根据此定义,"提交"一词表示发送给许可证颁发者或其代表人,任何电子的、口头的或书面的交流信息形式,
239 | 包括但不限于在由许可证颁发者或者代表其管理的电子邮件清单、源代码控制系统、以及发布跟踪系统上为
240 | 讨论和提高作品的交流,但不包括由版权所有者以书面形式明显标注或指定为"非贡献"的交流活动。
241 |
242 | "贡献者"是指许可证颁发者和代表从许可证颁发者接受之贡献的并随后包含在作品之贡献中的任何个人或法律实体。
243 |
244 | 2.版权许可证的授予
245 |
246 | 根据本许可证的条款,每个贡献者授予用户永久性的、全球性的、非专有性的、免费的、无版权费的、
247 | 不可撤销的版权许可证以源程序形式或目标形式复制、准备衍生作品、公开显示、公开执行、
248 | 授予分许可证、以及分发作品和这样的衍生作品。
249 |
250 | 3.专利许可证的授予
251 |
252 | 根据本许可证的条款,每个贡献者授予用户永久性的、全球性的、非专有性的、免费的、无版权费的、
253 | 不可撤销的(除在本部分进行说明)专利许可证对作品进行制作、让人制作、使用、提供销售、销售、
254 | 进口和其它转让,且这样的许可证仅适用于在所递交作品的贡献中因可由单一的或多个这样的贡献者
255 | 授予而必须侵犯的申请专利。如果用户对任何实体针对作品或作品中所涉及贡献提出因直接性或贡献性
256 | 专利侵权而提起专利法律诉讼(包括交互诉讼请求或反索赔),那么根据本许可证,授予用户针对作品
257 | 的任何专利许可证将在提起上述诉讼之日起终止。
258 |
259 | 4.重新分发
260 |
261 | 用户可在任何媒介中复制和分发作品或衍生作品之副本,无论是否修订,还是以源程序形式或目标形式,
262 | 条件是用户需满足下列条款:
263 |
264 | a) 用户必须为作品或衍生作品的任何其他接收者提供本许可证的副本;并且
265 |
266 | b) 用户必须让任何修改过的文件附带明显的通知,声明用户已更改文件;并且
267 |
268 | c) 用户必须从作品的源程序形式中保留衍生作品源程序形式的用户所分发的所有版权、专利、
269 | 商标和属性通知,但不包括不属于衍生作品任何部分的类似通知;并且
270 |
271 | d) 如果作品将"通知"文本文件包括为其分发作品的一部分,那么用户分发的任何衍生作品中须至少
272 | 在下列地方之一包括,在这样的通知文件中所包含的属性通知的可读副本,但不包括那些不属于衍生
273 | 作品任何部分的通知:在作为衍生作品一部分而分发的通知文本文件中;如果与衍生作品一起提供则
274 | 在源程序形式或文件中;或者通常作为第三方通知出现的时候和地方,在衍生作品中产生的画面中。
275 | 通知文件的内容仅供信息提供,并未对许可证进行修改。用户可在其分发的衍生作品中在作品的通知
276 | 文本后或作为附录添加自己的属性通知,条件是附加的属性通知不得构成修改本许可证。
277 |
278 | 用户可以为自身所做出的修订添加自己的版权声明并可对自身所做出修订内容或为这样的衍生作品作为
279 | 整体的使用、复制或分发提供附加或不同的条款,条件是用户对作品的使用、复制和分发必须符合本许
280 | 可证中声明的条款。
281 |
282 | 5.贡献的提交。
283 |
284 | 除非用户明确声明,在作品中由用户向许可证颁发者的提交若要包含在贡献中,必须在无任何附加条款下
285 | 符合本许可证的条款。尽管上面如此规定,执行许可证颁发者有关贡献的条款时,任何情况下均不得替代
286 | 或修改任何单独许可证协议的条款。
287 |
288 | 6.商标。本许可证并未授予用户使用许可证颁发者的商号、商标、服务标记或产品名称,除非将这些名称
289 | 用于合理性和惯例性描述作品起源和复制通知文件的内容时。
290 |
291 | 7.保证否认条款。除非因适用法律需要或书面同意,许可证颁发者以"按原样"基础提供作品(并且每个
292 | 贡献者提供其贡献),无任何明示的或暗示的保证或条件,包括但不限于关于所有权、不侵权、
293 | 商品适销性、或适用性的保证或条件。用户仅对使用或重新分发作品的正确性负责,并需承担根据本
294 | 许可证行使权限时的任何风险。
295 |
296 | 8.责任限制条款。在任何情况下并根据任何法律,无论是因侵权(包括过失)或根据合同,还是其它原因,
297 | 除非根据适用法律需要(例如故意行为和重大过失行为)或经书面同意,即使贡献者事先已被告知发生
298 | 损害的可能性,任何贡献者不就用户因使用本许可证或不能使用或无法使用作品(包括但不限于商誉损失、
299 | 停工、计算机失效或故障,或任何商业损坏或损失)而造成的损失,包括直接的、非直接的、特殊的、意外
300 | 的或间接的字符损坏而负责。
301 |
302 | 9.接受保证或附加责任。重新分发作品或及其衍生作品时,用户可选择提供或为符合本许可证承担之支持、
303 | 担保、赔偿或其它职责义务和/或权利而收取费用。但是,在承担上述义务时,用户只可代表用户本身和
304 | 用户本身责任来执行,无需代表任何其它贡献者,并且用户仅可保证、防护并保持每个贡献者不受任何
305 | 因此而产生的责任或对因用户自身承担这样的保证或附加责任而对这样的贡献者所提出的索赔。
306 |
307 | 条款结束
308 |
309 | 附录:如何向用户作品中应用Apache许可证。
310 |
311 | 若要向用户作品应用Apache许可证,请附加下列样本通知,将括号"[]"中的字段以用户自身的
312 | 区分信息来替换(但不包括括号)。文本必须以文件格式适当的注释句法包含在其中。
313 | 另外建议将文件名或类别名以及目的说明包含在相同的"打印页"上作为版权通知,以更加容易的区分出第三方档案。
314 |
315 | 版权所有 2016 ShenHuaJie iBase4J@163.com 根据2.0版本Apache许可证("许可证")授权;
316 | 根据本许可证,用户可以不使用此文件。
317 |
318 | 用户可从下列网址获得许可证副本:http://www.apache.org/licenses/LICENSE-2.0
319 | 除非因适用法律需要或书面同意,根据许可证分发的软件是基于"按原样"基础提供,
320 | 无任何明示的或暗示的保证或条件。详见根据许可证许可下,特定语言的管辖权限和限制。
321 |
322 | =======================================================
323 |
324 | 简要解释:
325 |
326 | 1.需要给代码的用户一份Apache Licence
327 | 2.如果你修改了代码,需要在被修改的文件中说明。
328 | 3.在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,
329 | 专利声明和其他原来作者规定需要包含的说明。
330 | 4.如果再发布的产品中包含一个Notice文件,则在Notice文件中需要带有 Apache Licence。
331 | 你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # auto-log
2 |
3 | [auto-log](https://github.com/houbb/auto-log) 是一款为 java 设计的自动日志监控框架。
4 |
5 | [](https://travis-ci.com/houbb/auto-log)
6 | [](http://mvnrepository.com/artifact/com.github.houbb/auto-log)
7 | [](https://github.com/houbb/auto-log/blob/master/LICENSE.txt)
8 | [](https://github.com/houbb/auto-log)
9 |
10 | ## 创作目的
11 |
12 | 经常会写一些工具,有时候手动加一些日志很麻烦,引入 spring 又过于大材小用。
13 |
14 | 所以希望从从简到繁实现一个工具,便于平时使用。
15 |
16 | ## 特性
17 |
18 | - 基于注解+字节码,配置灵活
19 |
20 | - 自动适配常见的日志框架
21 |
22 | - 支持编程式的调用
23 |
24 | - 支持注解式,完美整合 spring
25 |
26 | - 支持整合 spring-boot
27 |
28 | - 支持慢日志阈值指定,耗时,入参,出参,异常信息等常见属性指定
29 |
30 | - 支持 traceId 特性
31 |
32 | - 支持类级别定义注解
33 |
34 | - 支持自定义拦截器和过滤器
35 |
36 | - 支持 spring aop 注解切面自定义
37 |
38 | - 支持类似 dubbo filter 的拦截器链式调用
39 |
40 | - 支持日志条件输出,支持日志自适应输出
41 |
42 | - 支持日志的超长截断+丢弃策略,避免极端情况的性能问题
43 |
44 | ## 项目推荐
45 |
46 | 下面是一些日志、加解密、脱敏安全相关的库推荐:
47 |
48 | | 项目 | 介绍 |
49 | |:----------------------------------------------------------------------|:----------------------|
50 | | [sensitive-word](https://github.com/houbb/sensitive-word) | 高性能敏感词核心库 |
51 | | [sensitive-word-admin](https://github.com/houbb/sensitive-word-admin) | 敏感词控台,前后端分离 |
52 | | [sensitive](https://github.com/houbb/sensitive) | 高性能日志脱敏组件 |
53 | | [auto-log](https://github.com/houbb/auto-log) | 统一日志切面组件,支持全链路traceId |
54 | | [encryption-local](https://github.com/houbb/encryption-local) | 离线加密机组件 |
55 | | [encryption](https://github.com/houbb/encryption) | 加密机标准API+本地客户端 |
56 | | [encryption-server](https://github.com/houbb/encryption-server) | 加密机服务 |
57 |
58 | ## 变更日志
59 |
60 | > [变更日志](https://github.com/houbb/auto-log/blob/master/CHANGELOG.md)
61 |
62 | V0.11.0 变更
63 |
64 | - 支持日志的超长截断+丢弃策略,避免极端情况的性能问题
65 |
66 | ## 拓展阅读
67 |
68 | [日志开源组件(一)java 注解结合 spring aop 实现自动输出日志](https://houbb.github.io/2023/08/06/auto-log-01-overview)
69 |
70 | [日志开源组件(二)java 注解结合 spring aop 实现日志traceId唯一标识](https://houbb.github.io/2023/08/06/auto-log-02-trace-id)
71 |
72 | [日志开源组件(三)java 注解结合 spring aop 自动输出日志新增拦截器与过滤器](https://houbb.github.io/2023/08/06/auto-log-03-filter)
73 |
74 | [日志开源组件(四)如何动态修改 spring aop 切面信息?让自动日志输出框架更好用](https://houbb.github.io/2023/08/06/auto-log-04-dynamic-aop)
75 |
76 | [日志开源组件(五)如何将 dubbo filter 拦截器原理运用到日志拦截器中?](https://houbb.github.io/2023/08/06/auto-log-05-dubbo-interceptor)
77 |
78 | [日志开源组件(六)Adaptive Sampling 自适应采样](https://mp.weixin.qq.com/s/9JH3WfR6Y474LCbY2mZxZQ)
79 |
80 | [高性能日志脱敏组件(一)java 日志脱敏框架 sensitive,优雅的打印脱敏日志](https://mp.weixin.qq.com/s/xzQNDF7s705iurk7N0uheQ)
81 |
82 | [高性能日志脱敏组件(二)金融用户敏感数据如何优雅地实现脱敏?](https://mp.weixin.qq.com/s/ljChFiNLzV6GLaUDjehA0Q)
83 |
84 | [高性能日志脱敏组件(三)日志脱敏之后,无法根据信息快速定位怎么办?](https://mp.weixin.qq.com/s/tZqOH_8QTKrD1oaclNoewg)
85 |
86 | [高性能日志脱敏组件(四)基于 log4j2 插件实现统一日志脱敏,性能远超正则替换](https://mp.weixin.qq.com/s/ZlWRqT7S92aXFuy-l9Uh3Q)
87 |
88 | [高性能日志脱敏组件(五)已支持 log4j2 和 logback 插件](https://mp.weixin.qq.com/s/3ARK6PW7pyUhAbO2ctnndg)
89 |
90 | # 快速开始
91 |
92 | ## maven 引入
93 |
94 | ```xml
95 |
96 | com.github.houbb
97 | auto-log-core
98 | 0.12.0
99 |
100 | ```
101 |
102 | ## 入门案例
103 |
104 | ```java
105 | UserService userService = AutoLogHelper.proxy(new UserServiceImpl());
106 | userService.queryLog("1");
107 | ```
108 |
109 | - 日志如下
110 |
111 | ```
112 | 信息: [TID=9d5ad747342e4f909d42001f1419c58b][METHOD=com.github.houbb.auto.log.test.service.impl.UserServiceImpl.queryLog:java.lang.String#查询日志][PARAM=["1"]][RESULT="result-1"][COST=607 ms]
113 | ```
114 |
115 | ### 属性说明
116 |
117 | | 属性 | 说明 |
118 | |:-------|:------|
119 | | TID | 日志跟踪号 |
120 | | METHOD | 方法签名 |
121 | | PARAM | 方法入参 |
122 | | RESULT | 方法出参 |
123 | | COST | 方法耗时 |
124 | | SLOW-THRESHOLD | 慢日志阈值 |
125 | | EXCEPTION | 方法异常 |
126 |
127 | ### 代码
128 |
129 | 其中方法实现如下:
130 |
131 | - UserService.java
132 |
133 | ```java
134 | public interface UserService {
135 |
136 | String queryLog(final String id);
137 |
138 | }
139 | ```
140 |
141 | - UserServiceImpl.java
142 |
143 | 直接使用注解 `@AutoLog` 指定需要打日志的方法即可。
144 |
145 | ```java
146 | public class UserServiceImpl implements UserService {
147 |
148 | @Override
149 | @AutoLog(description = "查询日志", enableTraceId = true)
150 | public String queryLog(String id) {
151 | return "result-"+id;
152 | }
153 |
154 | }
155 | ```
156 |
157 | # 注解说明
158 |
159 | ## @AutoLog
160 |
161 | 核心注解 `@AutoLog` 的属性说明如下:
162 |
163 | | 属性 | 类型 | 默认值 | 说明 |
164 | |:--|:--|:--|:--|
165 | | enable | boolean | true | 是否启用 |
166 | | param | boolean | true | 是否打印入参 |
167 | | result | boolean | true | 是否打印出参 |
168 | | costTime | boolean | false | 是否打印耗时 |
169 | | exception | boolean | true | 是否打印异常 |
170 | | slowThresholdMills | long | -1 | 当这个值大于等于 0 时,且耗时超过配置值,会输出慢日志 |
171 | | description | string |"" | 方法描述,默认选择方法名称 |
172 | | paramFilter | Class | WebParamFilter | 入参过滤器,支持自定义 |
173 | | traceId | Class | Id.class | 日志跟踪号生成策略 |
174 | | enableTraceId | boolean | true | 是否启用 traceId 的变化 |
175 |
176 | 使用建议,在入口的方法中设置 `enableTraceId=true`,会统一设置 traceId,贯穿整个日志周期。 底层依赖的 service/biz 层等,设置为 false 即可。
177 |
178 | # 自定义策略
179 |
180 | ## 自定义日志拦截器(interceptor)
181 |
182 | ### 内置拦截器
183 |
184 | `AutoLogCommonFilter` 默认日志增强实现
185 |
186 | ### 定义
187 |
188 | 直接实现 `CommonFilter` 类,并且实现对应的方法即可。
189 |
190 | ```java
191 | package com.github.houbb.auto.log.test.interceptor;
192 |
193 | import com.github.houbb.auto.log.core.constant.AutoLogAttachmentKeyConst;
194 | import com.github.houbb.common.filter.annotation.FilterActive;
195 | import com.github.houbb.common.filter.api.CommonFilter;
196 | import com.github.houbb.common.filter.api.Invocation;
197 | import com.github.houbb.common.filter.api.Invoker;
198 | import com.github.houbb.common.filter.api.Result;
199 | import com.github.houbb.common.filter.exception.CommonFilterException;
200 |
201 | /**
202 | * 自定义日志拦截器
203 | * @author binbin.hou
204 | * @since 0.0.12
205 | */
206 | @FilterActive(order = 1)
207 | public class MyAutoLogInterceptor implements CommonFilter {
208 |
209 | @Override
210 | public Result invoke(Invoker invoker, Invocation invocation) throws CommonFilterException {
211 | final String tid = (String) invocation.getAttachment(AutoLogAttachmentKeyConst.AUTO_LOG_TRACE_ID);
212 | System.out.println("my test filter before " + tid);
213 | Result result = invoker.invoke(invocation);
214 | System.out.println("my test filter after " + tid);
215 |
216 | return result;
217 | }
218 |
219 | }
220 | ```
221 |
222 | 我们可以通过 `@FilterActive(order = 1)` 指定拦截器执行的顺序,数值越小,越先执行。
223 |
224 | `invocation.getAttachment(AutoLogAttachmentKeyConst.AUTO_LOG_TRACE_ID)` 可以获取 invocation 中传递的属性。
225 |
226 | ### 使用
227 |
228 | SPI 指定
229 |
230 | 创建文件 `resources\META-INF\services\com.github.houbb.common.filter.api.CommonFilter`
231 |
232 | 在文件中指定我们定义的接口:
233 |
234 | ```
235 | com.github.houbb.auto.log.test.interceptor.MyAutoLogInterceptor
236 | ```
237 |
238 | ### 测试效果
239 |
240 | ```
241 | my test filter before 2bc181d4efb8408e948072022c9227c0
242 | my test filter after 2bc181d4efb8408e948072022c9227c0
243 | 八月 06, 2023 8:13:19 下午 com.github.houbb.auto.log.core.support.interceptor.chain.AutoLogCommonFilter info
244 | 信息: [TID=2bc181d4efb8408e948072022c9227c0][METHOD=com.github.houbb.auto.log.test.service.impl.UserServiceImpl.queryLog:java.lang.String#查询日志][PARAM=["1"]][RESULT="result-1"][COST=535 ms]
245 | ```
246 |
247 | ## 自定义入参过滤器(paramFilter)
248 |
249 | ### 内置
250 |
251 | `WebParamFilter` 主要用于过滤 HttpRequest HttpServlet 等无法直接 JSON 序列化的对象。
252 |
253 | ### 自定义
254 |
255 | 直接继承 `AbstractParamFilter` 类实现对应的方法即可。
256 |
257 | ```java
258 | public class MyParamFilter extends AbstractParamFilter {
259 |
260 | @Override
261 | protected Object[] doFilter(Object[] params) {
262 | Object[] newParams = new Object[1];
263 | newParams[0] = "设置我我想要的值";
264 | return newParams;
265 | }
266 |
267 | }
268 | ```
269 |
270 | ### 使用
271 |
272 | 指定对应的参数过滤器。这样,无论入参是什么,都会变成我们指定的 `[设置我我想要的值]`。
273 |
274 | ```java
275 | @AutoLog(paramFilter = MyParamFilter.class)
276 | public String paramFilter() {
277 | return "自定义入参过滤器";
278 | }
279 | ```
280 |
281 |
282 | # spring 整合使用
283 |
284 | 完整示例参考 [SpringServiceTest](https://github.com/houbb/auto-log/tree/master/auto-log-test/src/test/java/com/github/houbb/auto/log/spring/SpringServiceTest.java)
285 |
286 | ## maven 引入
287 |
288 | ```xml
289 |
290 | com.github.houbb
291 | auto-log-spring
292 | 0.12.0
293 |
294 | ```
295 |
296 | ## 注解声明
297 |
298 | 使用 `@EnableAutoLog` 启用自动日志输出
299 |
300 | ```java
301 | @Configurable
302 | @ComponentScan(basePackages = "com.github.houbb.auto.log.test.service")
303 | @EnableAutoLog
304 | public class SpringConfig {
305 | }
306 | ```
307 |
308 | ## 测试代码
309 |
310 | ```java
311 | @ContextConfiguration(classes = SpringConfig.class)
312 | @RunWith(SpringJUnit4ClassRunner.class)
313 | public class SpringServiceTest {
314 |
315 | @Autowired
316 | private UserService userService;
317 |
318 | @Test
319 | public void queryLogTest() {
320 | userService.queryLog("1");
321 | }
322 |
323 | }
324 | ```
325 |
326 | - 输出结果
327 |
328 | ```
329 | 信息: public java.lang.String com.github.houbb.auto.log.test.service.impl.UserServiceImpl.queryLog(java.lang.String) param is [1]
330 | 五月 30, 2020 12:17:51 下午 com.github.houbb.auto.log.core.support.interceptor.AutoLogMethodInterceptor info
331 | 信息: public java.lang.String com.github.houbb.auto.log.test.service.impl.UserServiceImpl.queryLog(java.lang.String) result is result-1
332 | 五月 30, 2020 12:17:51 下午 org.springframework.context.support.GenericApplicationContext doClose
333 | ```
334 |
335 | ## 切面自定义
336 |
337 | ### 原理解释
338 |
339 | spring aop 的切面读取自 `@Value("${auto.log.pointcut}")`,默认为值 `@within(com.github.houbb.auto.log.annotation.AutoLog)||@annotation(com.github.houbb.auto.log.annotation.AutoLog)`
340 |
341 | 也就是默认是读取被 `@AutoLog` 指定的方法或者类。
342 |
343 | 当然,这并不够方便,我们希望可以想平时写 aop 注解一样,指定 spring aop 的扫描范围,直接在 spring 中指定一下 `auto.log.pointcut` 的属性值即可。
344 |
345 | ### 测试例子
346 |
347 | > [完整测试代码](https://github.com/houbb/auto-log/blob/master/auto-log-test/src/test/java/com/github/houbb/auto/log/dynamic/SpringDynamicServiceTest.java)
348 |
349 | 我们在配置文件 `autoLogConfig.properties` 中自定义下包扫描的范围:
350 |
351 | ```
352 | auto.log.pointcut=execution(* com.github.houbb.auto.log.test.dynamic.service.MyAddressService.*(..))
353 | ```
354 |
355 | 自定义测试 service
356 |
357 | ```java
358 | package com.github.houbb.auto.log.test.dynamic.service;
359 |
360 | import org.springframework.stereotype.Service;
361 |
362 | @Service
363 | public class MyAddressService {
364 |
365 | public String queryAddress(String id) {
366 | return "address-" + id;
367 | }
368 |
369 | }
370 | ```
371 |
372 | 自定义 spring 配置,指定我们定义的配置文件。springboot 啥的,可以直接放在 application.properties 中指定,此处仅作为演示。
373 |
374 | ```java
375 | @Configurable
376 | @ComponentScan(basePackages = "com.github.houbb.auto.log.test.dynamic.service")
377 | @EnableAutoLog
378 | @PropertySource("classpath:autoLogConfig.properties")
379 | public class SpringDynamicConfig {
380 | }
381 | ```
382 |
383 | 测试
384 |
385 | ```java
386 | @ContextConfiguration(classes = SpringDynamicConfig.class)
387 | @RunWith(SpringJUnit4ClassRunner.class)
388 | public class SpringDynamicServiceTest {
389 |
390 | @Autowired
391 | private MyAddressService myAddressService;
392 |
393 | @Autowired
394 | private MyUserService myUserService;
395 |
396 | @Test
397 | public void queryUserTest() {
398 | // 不会被日志拦截
399 | myUserService.queryUser("1");
400 | }
401 |
402 | @Test
403 | public void queryAddressTest() {
404 | // 会被日志拦截
405 | myAddressService.queryAddress("1");
406 | }
407 |
408 | }
409 | ```
410 |
411 | # springboot 整合使用
412 |
413 | ## maven 引入
414 |
415 | ```xml
416 |
417 | com.github.houbb
418 | auto-log-springboot-starter
419 | 0.12.0
420 |
421 | ```
422 |
423 | 只需要引入 jar 即可,其他的什么都不用配置。
424 |
425 | 使用方式和 spring 一致。
426 |
427 | ## 测试
428 |
429 | ```java
430 | @Autowired
431 | private UserService userService;
432 |
433 | @Test
434 | public void queryLogTest() {
435 | userService.query("spring-boot");
436 | }
437 | ```
438 |
439 | # 开源地址
440 |
441 | > Github: [https://github.com/houbb/auto-log](https://github.com/houbb/auto-log)
442 |
443 | > Gitee: [https://gitee.com/houbinbin/auto-log](https://gitee.com/houbinbin/auto-log)
444 |
445 | # Road-Map
446 |
447 | - [ ] distributed trace
448 |
449 | - [ ] 全局配置 比如全局的慢日志阈值设置等 参考 sandglass 中如何加载注解中的配置信息?(基于配置文件)
450 |
451 | - [x] 比例采样策略
452 |
453 | - [x] 自适应采样策略
454 |
455 | - [x] 改进 interceptor 拦截器,类似 dubbo filter
456 |
457 | - [x] 优化日志中的方法路径名称
458 |
459 | - [ ] 编译时注解特性 类似 aspectj
460 |
461 | - [ ] 基于 agent 特性,类似 sky-walking
462 |
463 | ---------------------------------------------------
464 |
465 | - [ ] 流程
466 |
467 | 日志/trace 信息的生成
468 |
469 | 采集
470 |
471 | 存储
472 |
473 | 检索/分析
474 |
475 | 可视化
476 |
477 | # 开源矩阵
478 |
479 | | 编号 | 名称 | 简介 | 标签 |
480 | |:----|:----|:----|:----|
481 | | 1 | [sensitive](https://github.com/houbb/sensitive) | 基于注解的日志脱敏框架,更加优雅的日志打印 | 工具,日志 |
482 | | 2 | [auto-log](https://github.com/houbb/auto-log) | 日志自动输出 | 工具,日志 |
483 | | 3 | [heaven](https://github.com/houbb/heaven) | 收集开发中常用的工具类 | 工具 |
484 | | 4 | [resubmit](https://github.com/houbb/resubmit) | 防止重复提交框架 | 工具 |
485 | | 5 | [validator](https://github.com/houbb/validator) | 新一代校验框架 | 工具 |
486 | | 6 | [rate-limit](https://github.com/houbb/rate-limit) | 渐进式限流工具框架 | 工具 |
487 | | 7 | [lock](https://github.com/houbb/lock) | 开箱即用分布式锁 | 工具 |
488 | | 8 | [lombok-ex](https://github.com/houbb/lombok-ex) | 编译时注解框架,扩展 lombok | 工具 |
489 | | 9 | [csv](https://github.com/houbb/csv) | CSV的读写工具 | 工具 |
490 | | 10 | [iexcel](https://github.com/houbb/iexcel) | EXCEL的读写工具,避免OOM | 工具 |
491 | | 11 | [leetcode](https://github.com/houbb/leetcode) | 力扣算法个人学习笔记 | 学习 |
492 | | 12 | [awesome-metaverse-zh](https://github.com/houbb/awesome-metaverse-zh) | 元宇宙精选 | 学习 |
493 | | 13 | [rpc](https://github.com/houbb/rpc) | 手写rpc框架 | 学习,中间件 |
494 | | 14 | [mybatis](https://github.com/houbb/mybatis) | 手写mybatis框架 | 学习,中间件 |
495 | | 15 | [cache](https://github.com/houbb/cache) | 手写redis框架 | 学习,中间件 |
496 | | 16 | [mq](https://github.com/houbb/mq) | 手写mq框架 | 学习,中间件 |
497 | | 17 | [ioc](https://github.com/houbb/ioc) | 手写spring ioc框架 | 学习,中间件 |
498 | | 18 | [async](https://github.com/houbb/async) | 手写线程池异步框架 | 学习,中间件 |
499 | | 19 | [jdbc-pool](https://github.com/houbb/jdbc-pool) | 手写数据库连接池实现 | 学习,中间件 |
500 | | 20 | [sisyphus](https://github.com/houbb/sisyphus) | 支持注解的重试框架 | 学习,中间件 |
501 | | 21 | [sandglass](https://github.com/houbb/sandglass) | 任务调度时间框架 | 学习,中间件 |
502 | | 22 | [segment](https://github.com/houbb/segment) | 基于结巴的分词实现 | NLP |
503 | | 23 | [pinyin](https://github.com/houbb/pinyin) | 高性能中文转拼音工具 | NLP |
504 | | 24 | [opencc4j](https://github.com/houbb/opencc4j) | 中文繁简体转换 | NLP |
505 | | 25 | [word-checker](https://github.com/houbb/word-checker) | 中英文拼写检测 | NLP |
506 | | 26 | [sensitive-word](https://github.com/houbb/sensitive-word) | 敏感词 | NLP |
507 | | 27 | [nlp-hanzi-similar](https://github.com/houbb/nlp-hanzi-similar) | 汉字相似度 | NLP |
508 | | 28 | [word-cloud](https://github.com/houbb/word-cloud) | 好用的词云工具 | DOC |
509 | | 29 | [markdown-toc](https://github.com/houbb/markdown-toc) | 为文档生成目录 | DOC |
510 | | 30 | [idoc](https://github.com/houbb/idoc) | 项目自动生成文档 | DOC |
511 | | 31 | [metadata](https://github.com/houbb/metadata) | 数据库元数据表文档生成 | DOC |
512 | | 32 | [data-factory](https://github.com/houbb/data-factory) | 测试自动生成对象信息 | TEST |
513 | | 33 | [junitperf](https://github.com/houbb/junitperf) | 性能测试框架,测试报告生成 | TEST |
514 | | 34 | [houbb.github.io](https://github.com/houbb/houbb.github.io) | 个人博客 | 学习 |
515 |
--------------------------------------------------------------------------------
/auto-log-annotation/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | auto-log
7 | com.github.houbb
8 | 0.12.0
9 |
10 | 4.0.0
11 |
12 | auto-log-annotation
13 |
14 |
15 |
16 | com.github.houbb
17 | id-api
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/auto-log-annotation/src/main/java/com/github/houbb/auto/log/annotation/AutoLog.java:
--------------------------------------------------------------------------------
1 | package com.github.houbb.auto.log.annotation;
2 |
3 | import com.github.houbb.auto.log.api.IAutoLogSampleCondition;
4 | import com.github.houbb.auto.log.api.IParamFilter;
5 | import com.github.houbb.id.api.Id;
6 |
7 | import java.lang.annotation.*;
8 |
9 | /**
10 | * 自动注解
11 | *
12 | * 考虑自定义输出的格式?
13 | *
14 | * slowMillsThreshold 1000
15 | *
16 | * 日志标识。 TraceId
17 | * 日志输出级别。(默认为 info)
18 | *
19 | * 异常能处理类,callback 后期拓展
20 | * 其他:
21 | * 输出信息 ip 等等。
22 | *
23 | * 不强依赖 spring
24 | * 可以 CGLIB OP Proxy 实现
25 | *
26 | * SPI 深入
27 | * 日志输出深入 ILog String
28 | *
29 | * ToString() 的实现策略。
30 | *
31 | * 添加方法描述参数。
32 | *
33 | *
34 | * 配置优先级:类注解 低于 方法注解
35 | *
36 | * @author binbin.hou
37 | * @since 0.0.1
38 | */
39 | @Target({ElementType.METHOD, ElementType.TYPE})
40 | @Retention(RetentionPolicy.RUNTIME)
41 | @Inherited
42 | public @interface AutoLog {
43 |
44 | /**
45 | * 是否启用
46 | * @return 结果
47 | * @since 0.0.10
48 | */
49 | boolean enable() default true;
50 |
51 | /**
52 | * 输出参数
53 | * @return 参数
54 | * @since 0.0.1
55 | */
56 | boolean param() default true;
57 |
58 | /**
59 | * 是否输出结果
60 | * @return 结果
61 | * @since 0.0.1
62 | */
63 | boolean result() default true;
64 |
65 | /**
66 | * 是否输出时间
67 | * @return 耗时
68 | * @since 0.0.1
69 | */
70 | boolean costTime() default true;
71 |
72 | /**
73 | * 是否输出异常信息
74 | * @return 是否
75 | * @since 0.0.6
76 | */
77 | boolean exception() default true;
78 |
79 | /**
80 | * 慢日志阈值
81 | *
82 | * 当值小于 0 时,不进行慢日志统计。
83 | * 当值大于等于0时,当前值只要大于等于这个值,就进行统计。
84 | * @return 阈值
85 | * @since 0.0.4
86 | */
87 | long slowThresholdMills() default -1;
88 |
89 | /**
90 | * 方法描述
91 | * @return 方法描述
92 | * @since 0.0.7
93 | */
94 | String description() default "";
95 |
96 | /**
97 | * trace id 策略
98 | *
99 | * TODO: id 全局策略考虑从配置文件中读取
100 | *
101 | * 直接废弃,直接以 auto-trace 的为准
102 | *
103 | * @return 结果
104 | * @since 0.0.16
105 | */
106 | @Deprecated
107 | Class extends Id> traceId() default Id.class;
108 |
109 | /**
110 | * 是否日志跟踪号,建议只在最外层启用即可。
111 | * 1. controller
112 | * 2. mq
113 | * 3. rpc
114 | *
115 | * 所有调用的最外层入口设置为 true 即可, service 层等底层实现设置为 false
116 | *
117 | * @return 结果
118 | * @since 0.0.16
119 | */
120 | boolean enableTraceId() default false;
121 |
122 | /**
123 | * 采样条件
124 | * @return 采样
125 | * @since 0.5.0
126 | */
127 | Class extends IAutoLogSampleCondition> sampleCondition() default IAutoLogSampleCondition.class;
128 |
129 | /**
130 | * 采样值:
131 | *
132 | * 1. 当为 rate 采样时 0-100,只有当采样策略为随机的的时候才会生效。
133 | * @return 条件概率
134 | * @since 0.5.0
135 | */
136 | int sampleRate() default 100;
137 |
138 | }
139 |
--------------------------------------------------------------------------------
/auto-log-annotation/src/main/java/com/github/houbb/auto/log/api/IAutoLog.java:
--------------------------------------------------------------------------------
1 | package com.github.houbb.auto.log.api;
2 |
3 | /**
4 | * @author binbin.hou
5 | * @since 0.0.7
6 | */
7 | public interface IAutoLog {
8 |
9 | /**
10 | * 自动日志输出
11 | * @param context 上下文
12 | * @return 结果
13 | * @since 0.0.7
14 | * @throws Throwable 异常信息
15 | */
16 | Object autoLog(IAutoLogContext context) throws Throwable;
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/auto-log-annotation/src/main/java/com/github/houbb/auto/log/api/IAutoLogContext.java:
--------------------------------------------------------------------------------
1 | package com.github.houbb.auto.log.api;
2 |
3 | import com.github.houbb.auto.log.annotation.AutoLog;
4 |
5 | import java.lang.reflect.Method;
6 |
7 | /**
8 | * 自动日志输出上下文
9 | * @author binbin.hou
10 | * @since 0.0.7
11 | */
12 | public interface IAutoLogContext {
13 |
14 | /**
15 | * 注解信息
16 | * @return 注解信息
17 | * @since 0.0.7
18 | */
19 | AutoLog autoLog();
20 |
21 | /**
22 | * 参数信息
23 | * @return 参数信息
24 | * @since 0.0.7
25 | */
26 | Object[] params();
27 |
28 | /**
29 | * 方法信息
30 | * @return 方法信息
31 | * @since 0.0.7
32 | */
33 | Method method();
34 |
35 | /**
36 | * 方法执行
37 | * @return 执行
38 | * @since 0.0.7
39 | * @throws Throwable 异常信息
40 | */
41 | Object process() throws Throwable;
42 |
43 | /**
44 | * 设置处理类
45 | * @param autoLogObjectHandler 处理类
46 | */
47 | void autoLogObjectHandler(IAutoLogObjectHandler autoLogObjectHandler);
48 |
49 | /**
50 | * 获取处理类
51 | * @return 获取
52 | */
53 | IAutoLogObjectHandler autoLogObjectHandler();
54 |
55 | /**
56 | * 丢弃的大小限制
57 | */
58 | int discardSizeLimit();
59 |
60 | /**
61 | * 设置大小
62 | * @param discardSizeLimit 限制
63 | */
64 | void discardSizeLimit(int discardSizeLimit);
65 |
66 | /**
67 | * 最长的日志长度
68 | * @since 0.11.0
69 | */
70 | void maxLogLen(int len);
71 |
72 | /**
73 | * 最长的日志长度
74 | * @since 0.11.0
75 | */
76 | int maxLogLen();
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/auto-log-annotation/src/main/java/com/github/houbb/auto/log/api/IAutoLogObjectHandler.java:
--------------------------------------------------------------------------------
1 | package com.github.houbb.auto.log.api;
2 |
3 | /**
4 | * 对象处理器
5 | * @author binbin.hou
6 | * @since 0.10.0
7 | */
8 | public interface IAutoLogObjectHandler {
9 |
10 | /**
11 | * 处理对象
12 | * @param rawObject 原始对象
13 | * @param context 上下文
14 | * @return 结果
15 | * @throws Exception 异常信息
16 | */
17 | Object handle(Object rawObject, IAutoLogContext context) throws Exception;
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/auto-log-annotation/src/main/java/com/github/houbb/auto/log/api/IAutoLogSampleCondition.java:
--------------------------------------------------------------------------------
1 | package com.github.houbb.auto.log.api;
2 |
3 | /**
4 | * 采样条件
5 | * @author binbin.hou
6 | * @since 0.5.0
7 | */
8 | public interface IAutoLogSampleCondition {
9 |
10 | /**
11 | * 条件
12 | *
13 | * @param context 上下文
14 | * @return 结果
15 | * @since 0.5.0
16 | */
17 | boolean sampleCondition(IAutoLogContext context);
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/auto-log-annotation/src/main/java/com/github/houbb/auto/log/api/IParamFilter.java:
--------------------------------------------------------------------------------
1 | package com.github.houbb.auto.log.api;
2 |
3 | /**
4 | * 参数过滤器接口
5 | * @author binbin.hou
6 | * @since 0.0.12
7 | */
8 | public interface IParamFilter {
9 |
10 | /**
11 | * 入参过滤接口
12 | * @param context 上下文
13 | * @return 结果
14 | * @since 0.0.12
15 | */
16 | Object[] filter(IParamFilterContext context);
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/auto-log-annotation/src/main/java/com/github/houbb/auto/log/api/IParamFilterContext.java:
--------------------------------------------------------------------------------
1 | package com.github.houbb.auto.log.api;
2 |
3 | /**
4 | * 入参过滤器上下文
5 | * @author binbin.hou
6 | * @since 0.0.12
7 | */
8 | public interface IParamFilterContext {
9 |
10 | /**
11 | * 入参信息
12 | * @return 入参
13 | * @since 0.0.12
14 | */
15 | Object[] params();
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/auto-log-annotation/src/main/java/com/github/houbb/auto/log/exception/AutoLogRuntimeException.java:
--------------------------------------------------------------------------------
1 | package com.github.houbb.auto.log.exception;
2 |
3 | /**
4 | * @author binbin.hou
5 | * @since 0.0.10
6 | */
7 | public class AutoLogRuntimeException extends RuntimeException {
8 |
9 | public AutoLogRuntimeException() {
10 | }
11 |
12 | public AutoLogRuntimeException(String message) {
13 | super(message);
14 | }
15 |
16 | public AutoLogRuntimeException(String message, Throwable cause) {
17 | super(message, cause);
18 | }
19 |
20 | public AutoLogRuntimeException(Throwable cause) {
21 | super(cause);
22 | }
23 |
24 | public AutoLogRuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
25 | super(message, cause, enableSuppression, writableStackTrace);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/auto-log-core-extra/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.github.houbb
8 | auto-log
9 | 0.12.0
10 |
11 |
12 | auto-log-core-extra
13 |
14 |
15 | 8
16 | 8
17 | UTF-8
18 |
19 |
20 |
--------------------------------------------------------------------------------
/auto-log-core-extra/src/main/java/org/springframework/core/io/InputStreamSource.java:
--------------------------------------------------------------------------------
1 | //
2 | // Source code recreated from a .class file by IntelliJ IDEA
3 | // (powered by FernFlower decompiler)
4 | //
5 |
6 | package org.springframework.core.io;
7 |
8 | import java.io.IOException;
9 | import java.io.InputStream;
10 |
11 | public interface InputStreamSource {
12 | InputStream getInputStream() throws IOException;
13 | }
14 |
--------------------------------------------------------------------------------
/auto-log-core-extra/src/main/java/org/springframework/web/multipart/MultipartFile.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2002-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.web.multipart;
18 |
19 | import org.springframework.core.io.InputStreamSource;
20 |
21 | import java.io.File;
22 | import java.io.IOException;
23 | import java.io.InputStream;
24 |
25 | /**
26 | * A representation of an uploaded file received in a multipart request.
27 | *
28 | *
The file contents are either stored in memory or temporarily on disk.
29 | * In either case, the user is responsible for copying file contents to a
30 | * session-level or persistent store as and if desired. The temporary storage
31 | * will be cleared at the end of request processing.
32 | *
33 | * @author Juergen Hoeller
34 | * @author Trevor D. Cook
35 | * @since 29.09.2003
36 | */
37 | public interface MultipartFile extends InputStreamSource {
38 |
39 | /**
40 | * Return the name of the parameter in the multipart form.
41 | * @return the name of the parameter (never {@code null} or empty)
42 | */
43 | String getName();
44 |
45 | /**
46 | * Return the original filename in the client's filesystem.
47 | *
This may contain path information depending on the browser used,
48 | * but it typically will not with any other than Opera.
49 | * @return the original filename, or the empty String if no file has been chosen
50 | * in the multipart form, or {@code null} if not defined or not available
51 | */
52 | String getOriginalFilename();
53 |
54 | /**
55 | * Return the content type of the file.
56 | * @return the content type, or {@code null} if not defined
57 | * (or no file has been chosen in the multipart form)
58 | */
59 | String getContentType();
60 |
61 | /**
62 | * Return whether the uploaded file is empty, that is, either no file has
63 | * been chosen in the multipart form or the chosen file has no content.
64 | * @return 是否为空
65 | */
66 | boolean isEmpty();
67 |
68 | /**
69 | * Return the size of the file in bytes.
70 | * @return the size of the file, or 0 if empty
71 | */
72 | long getSize();
73 |
74 | /**
75 | * Return the contents of the file as an array of bytes.
76 | * @return the contents of the file as bytes, or an empty byte array if empty
77 | * @throws IOException in case of access errors (if the temporary store fails)
78 | */
79 | byte[] getBytes() throws IOException;
80 |
81 | /**
82 | * Return an InputStream to read the contents of the file from.
83 | *
The user is responsible for closing the returned stream.
84 | * @return the contents of the file as stream, or an empty stream if empty
85 | * @throws IOException in case of access errors (if the temporary store fails)
86 | */
87 | @Override
88 | InputStream getInputStream() throws IOException;
89 |
90 | /**
91 | * Transfer the received file to the given destination file.
92 | *
This may either move the file in the filesystem, copy the file in the
93 | * filesystem, or save memory-held contents to the destination file. If the
94 | * destination file already exists, it will be deleted first.
95 | *
If the target file has been moved in the filesystem, this operation
96 | * cannot be invoked again afterwards. Therefore, call this method just once
97 | * in order to work with any storage mechanism.
98 | *