use of ch.qos.logback.classic.Logger in project Alpha by alpha-asp.
the class SolverTests method enableDebugLog.
private static void enableDebugLog() {
Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.DEBUG);
}
use of ch.qos.logback.classic.Logger in project Alpha by alpha-asp.
the class SolverTests method enableTracing.
/**
* Sets the logging level to TRACE. Useful for debugging; call at beginning of test case.
*/
private static void enableTracing() {
Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(ch.qos.logback.classic.Level.TRACE);
}
use of ch.qos.logback.classic.Logger in project sling by apache.
the class ITAppenderServices method testOsgiAppenderRef.
@Test
public void testOsgiAppenderRef() throws Exception {
Configuration config = ca.getConfiguration(ITConfigAdminSupport.PID, null);
Dictionary<String, Object> p = new Hashtable<String, Object>();
p.put(ITConfigAdminSupport.LOG_LEVEL, "INFO");
p.put(ITConfigAdminSupport.LOGBACK_FILE, absolutePath("test-osg-appender-ref-config.xml"));
config.update(p);
delay();
Logger ref = (Logger) LoggerFactory.getLogger("foo.ref.osgi");
assertTrue(ref.isDebugEnabled());
TestAppender ta = registerAppender("foo.bar", "foo.baz");
delay();
Logger bar = (Logger) LoggerFactory.getLogger("foo.bar");
bar.setLevel(Level.DEBUG);
Logger baz = (Logger) LoggerFactory.getLogger("foo.baz");
baz.setLevel(Level.INFO);
bar.debug("Test message");
// Would not be logged
baz.debug("Test message");
ref.debug("Test message ref");
// One event should be logged.
assertEquals(2, ta.events.size());
}
use of ch.qos.logback.classic.Logger in project sling by apache.
the class ITAppenderServices method testAppenderService.
@Test
public void testAppenderService() throws Exception {
TestAppender ta = registerAppender("foo.bar", "foo.baz");
delay();
Logger bar = (Logger) LoggerFactory.getLogger("foo.bar");
bar.setLevel(Level.DEBUG);
Logger baz = (Logger) LoggerFactory.getLogger("foo.baz");
baz.setLevel(Level.INFO);
bar.debug("Test message");
// Would not be logged
baz.debug("Test message");
// One event should be logged.
assertEquals(1, ta.events.size());
}
use of ch.qos.logback.classic.Logger in project sling by apache.
the class AppenderTracker method detachAppender.
private void detachAppender(final AppenderInfo ai) {
if (ai != null) {
for (final String name : ai.getLoggers()) {
final Logger logger = loggerContext.getLogger(name);
logger.detachAppender(ai.appender);
}
ai.appender.stop();
}
}
Aggregations