本文整理匯總了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();
}
示例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);
}
示例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");
}
}
示例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);
}