use of org.apache.log4j.Category in project zm-mailbox by Zimbra.
the class ZimbraPatternLayout method main.
public static void main(String[] args) {
Layout layout = new ZimbraPatternLayout("[%z] - %m%n");
Category cat = Category.getInstance("some.cat");
cat.addAppender(new ConsoleAppender(layout, ConsoleAppender.SYSTEM_OUT));
ZimbraLog.addAccountNameToContext("my@account.com");
ZimbraLog.addMboxToContext(99);
cat.debug("Hello, log");
cat.info("Hello again...");
ZimbraLog.clearContext();
cat.info("No more context");
}
use of org.apache.log4j.Category in project alluxio by Alluxio.
the class LogUtils method process.
private static void process(org.apache.log4j.Logger log, String level, LogInfo result) throws IOException {
if (log == null) {
result.setMessage("log is null.");
return;
}
if (level != null) {
if (!level.equals(org.apache.log4j.Level.toLevel(level).toString())) {
result.setMessage("Bad level : " + level);
} else {
log.setLevel(org.apache.log4j.Level.toLevel(level));
result.setMessage("Setting Level to " + level);
}
}
org.apache.log4j.Level lev = null;
Category category = log;
while ((category != null) && ((lev = category.getLevel()) == null)) {
category = category.getParent();
}
if (lev != null) {
result.setLevel(lev.toString());
}
}
Aggregations