本文整理汇总了Java中org.apache.logging.log4j.core.ErrorHandler类的典型用法代码示例。如果您正苦于以下问题:Java ErrorHandler类的具体用法?Java ErrorHandler怎么用?Java ErrorHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorHandler类属于org.apache.logging.log4j.core包,在下文中一共展示了ErrorHandler类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RocketmqLog4j2Appender
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
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());
}
}
}
示例2: stop
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
/**
* 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;
}
示例3: RocketmqLog4j2Appender
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
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());
}
}
}
示例4: stop
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
/**
* 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;
}
示例5: setHandler
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
/**
* 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;
}
示例6: setHandler
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
/**
* 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;
}
示例7: getHandler
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
@Override
public ErrorHandler getHandler() {
return errorHandler;
}
示例8: setHandler
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
@Override
public void setHandler(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
示例9: getHandler
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
@Override
public ErrorHandler getHandler() {
throw new UnsupportedOperationException("Not implemented");
}
示例10: setHandler
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
@Override
public void setHandler(final ErrorHandler errorHandler) {
throw new UnsupportedOperationException("Not implemented");
}
示例11: getHandler
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
/**
* Returns the ErrorHandler, if any.
* @return The ErrorHandler.
*/
@Override
public ErrorHandler getHandler() {
return handler;
}
示例12: getHandler
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
@Override
public ErrorHandler getHandler() {
return null;
}
示例13: setHandler
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
@Override
public void setHandler(ErrorHandler errorHandler) {
}
示例14: getHandler
import org.apache.logging.log4j.core.ErrorHandler; //导入依赖的package包/类
/**
* Returns the ErrorHandler, if any.
*
* @return The ErrorHandler.
*/
@Override
public ErrorHandler getHandler() {
return handler;
}