Java 类org.apache.logging.log4j.core.ErrorHandler 实例源码

项目:rocketmq-rocketmq-all-4.1.0-incubating    文件:RocketmqLog4j2Appender.java   
protected RocketmqLog4j2Appender(String name, Filter filter, Layout<? extends Serializable> layout,
                                 boolean ignoreExceptions, String nameServerAddress, String producerGroup,
                                 String topic, String tag) {
    super(name, filter, layout, ignoreExceptions);
    this.producer = producer;
    this.topic = topic;
    this.tag = tag;
    this.nameServerAddress = nameServerAddress;
    this.producerGroup = producerGroup;
    try {
        this.producer = ProducerInstance.getInstance(this.nameServerAddress, this.producerGroup);
    } catch (Exception e) {
        ErrorHandler handler = this.getHandler();
        if (handler != null) {
            handler.error("Starting RocketmqLog4j2Appender [" + this.getName()
                    + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
        }
    }
}
项目:rocketmq-rocketmq-all-4.1.0-incubating    文件:RocketmqLog4j2Appender.java   
/**
 * When system exit,this method will be called to close resources
 *
 * @param timeout
 * @param timeUnit
 * @return
 */
public boolean stop(long timeout, TimeUnit timeUnit) {
    this.setStopping();
    try {
        ProducerInstance.removeAndClose(this.nameServerAddress, this.producerGroup);
    } catch (Exception e) {
        ErrorHandler handler = this.getHandler();
        if (handler != null) {
            handler.error("Closeing RocketmqLog4j2Appender [" + this.getName()
                    + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
        }
    }

    boolean stopped = super.stop(timeout, timeUnit, false);
    this.setStopped();
    return stopped;
}
项目:rocketmq    文件:RocketmqLog4j2Appender.java   
protected RocketmqLog4j2Appender(String name, Filter filter, Layout<? extends Serializable> layout,
    boolean ignoreExceptions, String nameServerAddress, String producerGroup,
    String topic, String tag) {
    super(name, filter, layout, ignoreExceptions);
    this.producer = producer;
    this.topic = topic;
    this.tag = tag;
    this.nameServerAddress = nameServerAddress;
    this.producerGroup = producerGroup;
    try {
        this.producer = ProducerInstance.getProducerInstance().getInstance(this.nameServerAddress, this.producerGroup);
    } catch (Exception e) {
        ErrorHandler handler = this.getHandler();
        if (handler != null) {
            handler.error("Starting RocketmqLog4j2Appender [" + this.getName()
                + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
        }
    }
}
项目:rocketmq    文件:RocketmqLog4j2Appender.java   
/**
 * When system exit,this method will be called to close resources
 */
public boolean stop(long timeout, TimeUnit timeUnit) {
    this.setStopping();
    try {
        ProducerInstance.getProducerInstance().removeAndClose(this.nameServerAddress, this.producerGroup);
    } catch (Exception e) {
        ErrorHandler handler = this.getHandler();
        if (handler != null) {
            handler.error("Closeing RocketmqLog4j2Appender [" + this.getName()
                + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
        }
    }

    boolean stopped = super.stop(timeout, timeUnit, false);
    this.setStopped();
    return stopped;
}
项目:log4j2    文件:AbstractAppender.java   
/**
 * The handler must be set before the appender is started.
 * @param handler The ErrorHandler to use.
 */
@Override
public void setHandler(final ErrorHandler handler) {
    if (handler == null) {
        LOGGER.error("The handler cannot be set to null");
    }
    if (isStarted()) {
        LOGGER.error("The handler cannot be changed once the appender is started");
        return;
    }
    this.handler = handler;
}
项目:logging-log4j2    文件:AbstractAppender.java   
/**
 * The handler must be set before the appender is started.
 * 
 * @param handler The ErrorHandler to use.
 */
@Override
public void setHandler(final ErrorHandler handler) {
    if (handler == null) {
        LOGGER.error("The handler cannot be set to null");
    }
    if (isStarted()) {
        LOGGER.error("The handler cannot be changed once the appender is started");
        return;
    }
    this.handler = handler;
}
项目:log4j2-redis-appender    文件:RedisAppender.java   
@Override
public ErrorHandler getHandler() {
    return errorHandler;
}
项目:log4j2-redis-appender    文件:RedisAppender.java   
@Override
public void setHandler(ErrorHandler errorHandler) {
    this.errorHandler = errorHandler;
}
项目:miru    文件:HttpKinesisLogAppender.java   
@Override
public ErrorHandler getHandler() {
    return errorHandler;
}
项目:miru    文件:HttpKinesisLogAppender.java   
@Override
public void setHandler(ErrorHandler errorHandler) {
    this.errorHandler = errorHandler;
}
项目:miru    文件:MiruStumptownInternalLogAppender.java   
@Override
public ErrorHandler getHandler() {
    return errorHandler;
}
项目:miru    文件:MiruStumptownInternalLogAppender.java   
@Override
public void setHandler(ErrorHandler errorHandler) {
    this.errorHandler = errorHandler;
}
项目:miru    文件:HttpMiruLogAppender.java   
@Override
public ErrorHandler getHandler() {
    return errorHandler;
}
项目:miru    文件:HttpMiruLogAppender.java   
@Override
public void setHandler(ErrorHandler errorHandler) {
    this.errorHandler = errorHandler;
}
项目:commons-testing    文件:Log4j2CollectionAppender.java   
@Override
public ErrorHandler getHandler() {
    throw new UnsupportedOperationException("Not implemented");
}
项目:commons-testing    文件:Log4j2CollectionAppender.java   
@Override
public void setHandler(final ErrorHandler errorHandler) {
    throw new UnsupportedOperationException("Not implemented");
}
项目:log4j2    文件:AbstractAppender.java   
/**
 * Returns the ErrorHandler, if any.
 * @return The ErrorHandler.
 */
@Override
public ErrorHandler getHandler() {
    return handler;
}
项目:Bukkit-SSHD    文件:StreamHandlerAppender.java   
@Override
public ErrorHandler getHandler() {
    return null;
}
项目:Bukkit-SSHD    文件:StreamHandlerAppender.java   
@Override
public void setHandler(ErrorHandler errorHandler) {

}
项目:logging-log4j2    文件:AbstractAppender.java   
/**
 * Returns the ErrorHandler, if any.
 * 
 * @return The ErrorHandler.
 */
@Override
public ErrorHandler getHandler() {
    return handler;
}