All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyun.openservices.log.log4j2.LoghubAppenderCallback Maven / Gradle / Ivy

There is a newer version: 0.1.14
Show newest version
package com.aliyun.openservices.log.log4j2;

import com.aliyun.openservices.aliyun.log.producer.Callback;
import com.aliyun.openservices.aliyun.log.producer.Result;
import com.aliyun.openservices.log.common.LogItem;
import org.apache.logging.log4j.Logger;

import java.util.List;

/**
 * Created by brucewu on 2018/1/5.
 */
public class LoghubAppenderCallback implements Callback {

    private Logger logger;

    private String project;

    private String logStore;

    private String topic;

    private String source;

    private List logItems;

    public LoghubAppenderCallback(Logger logger, String project, String logStore, String topic,
                                  String source, List logItems) {
        super();
        this.logger = logger;
        this.project = project;
        this.logStore = logStore;
        this.topic = topic;
        this.source = source;
        this.logItems = logItems;
    }

    @Override
    public void onCompletion(Result result) {
        if (!result.isSuccessful()) {
            logger.error(
                    "Failed to send log, project=" + project
                            + ", logStore=" + logStore
                            + ", topic=" + topic
                            + ", source=" + source
                            + ", logItem=" + logItems
                            + ", errorCode=" + result.getErrorCode()
                            + ", errorMessage=" + result.getErrorMessage());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy