Coder Social home page Coder Social logo

logger.api's Issues

构造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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.