本文整理汇总了Java中ch.qos.logback.classic.BasicConfigurator.configure方法的典型用法代码示例。如果您正苦于以下问题:Java BasicConfigurator.configure方法的具体用法?Java BasicConfigurator.configure怎么用?Java BasicConfigurator.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.classic.BasicConfigurator
的用法示例。
在下文中一共展示了BasicConfigurator.configure方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: autoConfig
import ch.qos.logback.classic.BasicConfigurator; //导入方法依赖的package包/类
public void autoConfig() throws JoranException {
StatusListenerConfigHelper.installIfAsked(loggerContext);
URL url = findURLOfDefaultConfigurationFile(true);
if (url != null) {
configureByResource(url);
} else {
Configurator c = EnvUtil.loadFromServiceLoader(Configurator.class);
if (c != null) {
try {
c.setContext(loggerContext);
c.configure(loggerContext);
} catch (Exception e) {
throw new LogbackException(String.format("Failed to initialize Configurator: %s using ServiceLoader",
c != null ? c.getClass().getCanonicalName() : "null"), e);
}
} else {
BasicConfigurator.configure(loggerContext);
}
}
}
示例2: initializeLogging
import ch.qos.logback.classic.BasicConfigurator; //导入方法依赖的package包/类
private static void initializeLogging(Arguments arguments) {
//bootstrap depends on logback for logging console output. if the clientApplication does not want logback, they
//need to exclude logback from their project dependencies and initialize their own logging
try {
AppMain.class.getClassLoader().loadClass("ch.qos.logback.classic.LoggerContext");
} catch (ClassNotFoundException e) {
System.err.println("No Logback found in classpath. Skipping logging initialization. This is expected if you are configuring the logging system yourself. If you are not configuring logging yourself and would like to use logging provided by java-bootstrap, ensure that the Logback dependency jar exists in your classpath.");
return;
}
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
context.reset();
BasicConfigurator.configure(context);
ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
Level level = Level.valueOf(arguments.logLevel.name().toUpperCase());
logger.setLevel(level);
logger.info("Initialized logging at {} level", level);
}
示例3: initLogging
import ch.qos.logback.classic.BasicConfigurator; //导入方法依赖的package包/类
protected LoggerContext initLogging() throws IOException {
LogManager.getLogManager().reset();
LogManager.getLogManager().readConfiguration();
LogManager.getLogManager().getLogger("").setLevel(java.util.logging.Level.INFO);
final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
context.reset();
BasicConfigurator configurator = new BasicConfigurator();
configurator.setContext(context);
configurator.configure(context);
context.getLogger(Logger.ROOT_LOGGER_NAME).setLevel(Level.INFO);
org.slf4j.bridge.SLF4JBridgeHandler.removeHandlersForRootLogger();
org.slf4j.bridge.SLF4JBridgeHandler.install();
return context;
}
示例4: resetLogging
import ch.qos.logback.classic.BasicConfigurator; //导入方法依赖的package包/类
@Before
public void resetLogging() {
LoggerContext loggerContext = ((Logger) LoggerFactory.getLogger(getClass()))
.getLoggerContext();
loggerContext.reset();
BasicConfigurator.configure(loggerContext);
}
示例5: setUp
import ch.qos.logback.classic.BasicConfigurator; //导入方法依赖的package包/类
@Before
public void setUp() {
loggerContext.setName("LB139");
BasicConfigurator.configure(loggerContext);
}