logger.api's Issues
设置 AsyncAppender 为 neverBlock ,或者 blocking 设置为 false
默认情况下,所有的 AsyncAppender ,都是队列满了之后阻塞。统一改为队列满了丢弃。
构造Slf4jLogger时有bug
在使用org.slf4j.LoggerFactory.getLogger(String name)的返回值作为参数构造Slf4jLogger实例时,忽略了并发初始化日志的场景,当日志正在初始化过程中时,此时获取LoggerFactory实例为org.slf4j.helpers.SubstituteLoggerFactory,返回的logger实例将为org.slf4j.helpers.SubstituteLogger,此时不应该抛出异常,返回的logger对象亦不应缓存起来,下次等到logger初始化完成后,会返回正常logger实例。
LoggerHelper.getErrorCodeStr(String, String, String, String) 里调用System.getProperty,效率有问题
com.taobao.middleware.logger.support.LoggerHelper.getErrorCodeStr(String, String, String, String)
/**
* 根据productName获取统一格式的ErrorCode输出
*
* @param productName 如 HSF,会根据 HSF.ErrorCodeMoreUrl 从 System属性中获取 more url 前缀. 可以参考:com.taobao.middleware.logger.support.LoggerConfig.MORE_INFO_URL
* @param errorCode 错误码,如HSF-001
* @param errorType 错误类型
* @param message 出错异常信息
*/
public static String getErrorCodeStr(String productName, String errorCode, String errorType, String message) {
String moreUrl = DEFAULT_MORE_URL;
if (productName != null) {
String customUrl = System.getProperty(productName.toUpperCase() + MORE_URL_POSFIX);
if (customUrl != null) {
moreUrl = customUrl;
}
}
这个地方会拿 System 的 properties , properties 是个 hash table ,并发比较高的时候会有性能问题
pom依赖少了一个t
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>tes</scope>
</dependency>
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.