Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoggerHelper.getErrorCodeStr(String, String, String, String) 里调用System.getProperty,效率有问题 #3

Closed
hengyunabc opened this issue Nov 21, 2019 · 0 comments

Comments

@hengyunabc
Copy link
Collaborator

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 ,并发比较高的时候会有性能问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant