use of org.apache.commons.logging.Log in project contribution by checkstyle.
the class CommonsLoggingListener method fileFinished.
/**
* @see com.puppycrawl.tools.checkstyle.api.AuditListener
*/
public void fileFinished(AuditEvent aEvt) {
if (mInitialized) {
final Log log = mLogFactory.getInstance(Checker.class);
log.info("File \"" + aEvt.getFileName() + "\" finished.");
}
}
use of org.apache.commons.logging.Log in project contribution by checkstyle.
the class CommonsLoggingListener method auditFinished.
/**
* @see com.puppycrawl.tools.checkstyle.api.AuditListener
*/
public void auditFinished(AuditEvent aEvt) {
if (mInitialized) {
final Log log = mLogFactory.getInstance(Checker.class);
log.info("Audit finished.");
}
}
use of org.apache.commons.logging.Log in project logging-log4j2 by apache.
the class LoggerTest method testLog.
@Test
public void testLog() {
final Log logger = LogFactory.getLog("LoggerTest");
logger.debug("Test message");
verify("List", "o.a.l.l.j.LoggerTest Test message MDC{}" + Strings.LINE_SEPARATOR);
logger.debug("Exception: ", new NullPointerException("Test"));
verify("List", "o.a.l.l.j.LoggerTest Exception: MDC{}" + Strings.LINE_SEPARATOR);
logger.info("Info Message");
verify("List", "o.a.l.l.j.LoggerTest Info Message MDC{}" + Strings.LINE_SEPARATOR);
logger.info("Info Message {}");
verify("List", "o.a.l.l.j.LoggerTest Info Message {} MDC{}" + Strings.LINE_SEPARATOR);
}
use of org.apache.commons.logging.Log in project logging-log4j2 by apache.
the class CallerInformationTest method testMethodLogger.
@Test
public void testMethodLogger() throws Exception {
final ListAppender app = ctx.getListAppender("Method").clear();
final Log logger = LogFactory.getLog("MethodLogger");
logger.info("More messages.");
logger.warn("CATASTROPHE INCOMING!");
logger.error("ZOMBIES!!!");
logger.warn("brains~~~");
logger.info("Itchy. Tasty.");
final List<String> messages = app.getMessages();
assertEquals("Incorrect number of messages.", 5, messages.size());
for (final String message : messages) {
assertEquals("Incorrect caller method name.", "testMethodLogger", message);
}
}
use of org.apache.commons.logging.Log in project logging-log4j2 by apache.
the class CallerInformationTest method testClassLogger.
@Test
public void testClassLogger() throws Exception {
final ListAppender app = ctx.getListAppender("Class").clear();
final Log logger = LogFactory.getLog("ClassLogger");
logger.info("Ignored message contents.");
logger.warn("Verifying the caller class is still correct.");
logger.error("Hopefully nobody breaks me!");
final List<String> messages = app.getMessages();
assertEquals("Incorrect number of messages.", 3, messages.size());
for (final String message : messages) {
assertEquals("Incorrect caller class name.", this.getClass().getName(), message);
}
}
Aggregations