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


Java ConsoleAppender.SYSTEM_ERR屬性代碼示例

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


在下文中一共展示了ConsoleAppender.SYSTEM_ERR屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setupLogging

private void setupLogging() {
    LogManager.getLogManager().reset();
    Logger.getRootLogger().getLoggerRepository().resetConfiguration();

    final Logger rootLogger = Logger.getRootLogger();
    final PatternLayout layout = new PatternLayout("%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n");
    final Level level = endPointHealthConfiguration.logLevel();

    final ConsoleAppender consoleAppender = new ConsoleAppender(layout, ConsoleAppender.SYSTEM_ERR);

    consoleAppender.setThreshold(level);
    consoleAppender.activateOptions();

    final FileAppender fileAppender = new FileAppender();

    fileAppender.setFile(endPointHealthConfiguration.logFile().getAbsolutePath());
    fileAppender.setLayout(layout);
    fileAppender.setThreshold(level);
    fileAppender.setAppend(true);
    fileAppender.setErrorHandler(new FallbackAppenderErrorHandler(rootLogger, fileAppender, consoleAppender));

    rootLogger.addAppender(fileAppender);

    fileAppender.activateOptions();
}
 
開發者ID:spypunk,項目名稱:endpoint-health,代碼行數:25,代碼來源:EndPointHealthServiceImpl.java

示例2: setUp

protected void setUp() throws Exception {
    super.setUp();

    Logger defaultLogger = Logger.getLogger(StopWatch.DEFAULT_LOGGER_NAME);
    ConsoleAppender stdErrAppender = new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_ERR);
    stdErrAppender.setName("log4jStdErrAppender");
    stdErrAppender.activateOptions();
    defaultLogger.addAppender(stdErrAppender);
}
 
開發者ID:codehaus,項目名稱:perf4j,代碼行數:9,代碼來源:Log4JStopWatchTest.java

示例3: SystemLogger

private SystemLogger() { 
	systemLogger = Logger.getLogger("System");
	/* System verbosity (Standard Out) */
	consoleAppender = new ConsoleAppender(new PatternLayout("%m"), ConsoleAppender.SYSTEM_ERR);
	consoleAppender.setEncoding("UTF-16");
	systemLogger.addAppender(consoleAppender);
	if (System.getProperty("Malt.verbosity") != null) {
		setSystemVerbosityLevel(System.getProperty("Malt.verbosity").toUpperCase());
	} else {
		setSystemVerbosityLevel("INFO");
	}
}
 
開發者ID:jhamalt,項目名稱:maltparser,代碼行數:12,代碼來源:SystemLogger.java

示例4: initLog4j

private static void initLog4j() {
    PatternLayout layout = new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN);
    ConsoleAppender appender = new ConsoleAppender(layout, ConsoleAppender.SYSTEM_ERR);
    BasicConfigurator.configure(appender);
}
 
開發者ID:upenn-libraries,項目名稱:xmlaminar,代碼行數:5,代碼來源:Driver.java


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