Log4jALAAppender.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:Log4jALA 作者:
/**
 * @see org.apache.log4j.AppenderSkeleton#activateOptions()
 */
@Override
public void activateOptions() {
    try {
        // Close previous connections if reactivating
        if (httpDataCollector != null) {
            //httpDataCollector.close();
            close();
        }

        if (StringUtils.isEmpty(workspaceId)) {
            throw new Exception(
                    String.format("the Log4jALAAppender property workspaceId [%s] shouldn't be empty (log4j.xml)",
                            this.workspaceId));
        }
        if (StringUtils.isEmpty(sharedKey)) {
            throw new Exception(String.format(
                    "the Log4jALAAppender property sharedKey [%s] shouldn't be empty (log4j.xml)", this.sharedKey));
        }
        if (StringUtils.isEmpty(logType)) {
            throw new Exception(String.format(
                    "the Log4jALAAppender property logType [%s] shouldn't be empty (log4j.xml)", this.logType));
        }

        serializer = new LoggingEventSerializer();

        httpDataCollector = new HTTPDataCollector(this.workspaceId, this.sharedKey,
                this.threadPoolSize <= 0 ? 1000 : this.threadPoolSize, this, this.proxyHost, this.proxyPort);

    } catch (Exception e) {
        errorHandler.error("Unexpected exception while initialising HTTPDataCollector.", e,
                ErrorCode.GENERIC_FAILURE);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号