本文整理汇总了Java中org.apache.log4j.spi.ErrorHandler类的典型用法代码示例。如果您正苦于以下问题:Java ErrorHandler类的具体用法?Java ErrorHandler怎么用?Java ErrorHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorHandler类属于org.apache.log4j.spi包,在下文中一共展示了ErrorHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseErrorHandler
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
private void parseErrorHandler(
final ErrorHandler eh,
final String errorHandlerPrefix,
final Properties props,
final LoggerRepository hierarchy) {
boolean rootRef = OptionConverter.toBoolean(
OptionConverter.findAndSubst(errorHandlerPrefix + ROOT_REF, props), false);
if (rootRef) {
eh.setLogger(hierarchy.getRootLogger());
}
String loggerName = OptionConverter.findAndSubst(errorHandlerPrefix + LOGGER_REF , props);
if (loggerName != null) {
Logger logger = (loggerFactory == null) ? hierarchy.getLogger(loggerName)
: hierarchy.getLogger(loggerName, loggerFactory);
eh.setLogger(logger);
}
String appenderName = OptionConverter.findAndSubst(errorHandlerPrefix + APPENDER_REF_TAG, props);
if (appenderName != null) {
Appender backup = parseAppender(props, appenderName);
if (backup != null) {
eh.setBackupAppender(backup);
}
}
}
示例2: setErrorHandler
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
public
void setErrorHandler(ErrorHandler eh) {
if(eh == null) {
// This is a programming error on the part of the enclosing appender.
throw new IllegalArgumentException("Attempted to set null ErrorHandler.");
} else {
this.errorHandler = eh;
}
}
示例3: setErrorHandler
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
/**
Set the {@link ErrorHandler} for this Appender.
@since 0.9.0
*/
public
synchronized
void setErrorHandler(ErrorHandler eh) {
if(eh == null) {
// We do not throw exception here since the cause is probably a
// bad config file.
LogLog.warn("You have tried to set a null error-handler.");
} else {
this.errorHandler = eh;
}
}
示例4: setErrorHandler
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
/**
Set the {@link ErrorHandler} for this WriterAppender and also the
underlying {@link QuietWriter} if any. */
public synchronized void setErrorHandler(ErrorHandler eh) {
if(eh == null) {
LogLog.warn("You have tried to set a null error-handler.");
} else {
this.errorHandler = eh;
if(this.qw != null) {
this.qw.setErrorHandler(eh);
}
}
}
示例5: convertArg
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
/**
Convert <code>val</code> a String parameter to an object of a
given type.
*/
protected
Object convertArg(String val, Class type) {
if(val == null)
return null;
String v = val.trim();
if (String.class.isAssignableFrom(type)) {
return val;
} else if (Integer.TYPE.isAssignableFrom(type)) {
return new Integer(v);
} else if (Long.TYPE.isAssignableFrom(type)) {
return new Long(v);
} else if (Boolean.TYPE.isAssignableFrom(type)) {
if ("true".equalsIgnoreCase(v)) {
return Boolean.TRUE;
} else if ("false".equalsIgnoreCase(v)) {
return Boolean.FALSE;
}
} else if (Priority.class.isAssignableFrom(type)) {
return OptionConverter.toLevel(v, (Level) Level.DEBUG);
} else if (ErrorHandler.class.isAssignableFrom(type)) {
return OptionConverter.instantiateByClassName(v,
ErrorHandler.class, null);
}
return null;
}
示例6: FallbackAppender
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
/**
* Constructor
*/
public FallbackAppender() {
ErrorHandler fb = new FallbackErrorHandler();
this.setErrorHandler(fb);
fb.setAppender(this);
Appender rootAppen = Logger.getRootLogger().getAppender("RootAppender");
if (rootAppen != null) {
fb.setBackupAppender(rootAppen);
}
Logger logger = Logger.getLogger(LoggingInvocationProcessor.class);
fb.setLogger(logger);
}
示例7: FailbackAppender
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
/**
* Constructor
*/
public FailbackAppender() {
ErrorHandler fb = new FallbackErrorHandler();
this.setErrorHandler(fb);
fb.setAppender(this);
Appender rootAppen = Logger.getRootLogger().getAppender("RootAppender");
if (rootAppen != null) {
fb.setBackupAppender(rootAppen);
}
Logger logger = Logger.getLogger(LoggingInvocationProcessor.class);
fb.setLogger(logger);
}
示例8: setErrorHandler
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
/**
* Set the {@link ErrorHandler} for this Appender.
*
* @since 0.9.0
*/
@Override
public synchronized void setErrorHandler(ErrorHandler eh) {
if (eh != null) {
this.errorHandler = eh;
}
}
示例9: getErrorHandler
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
@Override
public ErrorHandler getErrorHandler() {
// TODO Auto-generated method stub
return null;
}
示例10: setErrorHandler
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
@Override
public void setErrorHandler(ErrorHandler arg0) {
// TODO Auto-generated method stub
}
示例11: setErrorHandler
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
@Override
public void setErrorHandler(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
示例12: getErrorHandler
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
@Override
public ErrorHandler getErrorHandler() {
return errorHandler;
}
示例13: getErrorHandler
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
@Override
public ErrorHandler getErrorHandler() {
return null;
}
示例14:
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
@Override
public void setErrorHandler(ErrorHandler errorHandler) {
super.setErrorHandler(errorHandler);
}
示例15: getErrorHandler
import org.apache.log4j.spi.ErrorHandler; //导入依赖的package包/类
public ErrorHandler getErrorHandler()
{
return null;
}