本文整理汇总了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);
}