當前位置: 首頁>>代碼示例>>Java>>正文


Java ErrorHandler.setLogger方法代碼示例

本文整理匯總了Java中org.apache.log4j.spi.ErrorHandler.setLogger方法的典型用法代碼示例。如果您正苦於以下問題:Java ErrorHandler.setLogger方法的具體用法?Java ErrorHandler.setLogger怎麽用?Java ErrorHandler.setLogger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.log4j.spi.ErrorHandler的用法示例。


在下文中一共展示了ErrorHandler.setLogger方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
	}
}
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:25,代碼來源:PropertyConfigurator.java

示例2: 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);
}
 
開發者ID:spacewalkproject,項目名稱:spacewalk,代碼行數:17,代碼來源:FallbackAppender.java

示例3: 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);
}
 
開發者ID:spacewalkproject,項目名稱:spacewalk,代碼行數:17,代碼來源:FailbackAppender.java

示例4: parseErrorHandler

import org.apache.log4j.spi.ErrorHandler; //導入方法依賴的package包/類
/**
    Used internally to parse an {@link ErrorHandler} element.
  */
 protected
 void parseErrorHandler(Element element, Appender appender) {
   ErrorHandler eh = (ErrorHandler) OptionConverter.instantiateByClassName(
                                      subst(element.getAttribute(CLASS_ATTR)),
                                      org.apache.log4j.spi.ErrorHandler.class, 
				       null);
   
   if(eh != null) {
     eh.setAppender(appender);

     PropertySetter propSetter = new PropertySetter(eh);
     NodeList children = element.getChildNodes();
     final int length 	= children.getLength();

     for (int loop = 0; loop < length; loop++) {
Node currentNode = children.item(loop);
if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
  Element currentElement = (Element) currentNode;
  String tagName = currentElement.getTagName();
  if(tagName.equals(PARAM_TAG)) {
           setParameter(currentElement, propSetter);
  } else if(tagName.equals(APPENDER_REF_TAG)) {
    eh.setBackupAppender(findAppenderByReference(currentElement));
  } else if(tagName.equals(LOGGER_REF)) {
    String loggerName = currentElement.getAttribute(REF_ATTR);	    
    Logger logger = (catFactory == null) ? repository.getLogger(loggerName)
               : repository.getLogger(loggerName, catFactory);
    eh.setLogger(logger);
  } else if(tagName.equals(ROOT_REF)) {
    Logger root = repository.getRootLogger();
    eh.setLogger(root);
  } else {
         quietParseUnrecognizedElement(eh, currentElement, props);
     }
}
     }
     propSetter.activate();
     appender.setErrorHandler(eh);
   }
 }
 
開發者ID:cacheonix,項目名稱:cacheonix-core,代碼行數:44,代碼來源:DOMConfigurator.java


注:本文中的org.apache.log4j.spi.ErrorHandler.setLogger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。