We did this and stayed with the magazine for two years. In short, you will end up mixing JUL and logback settings, since your application will use logback, and Google classes will use JUL directly (and you cannot redirect JUL to logback in GAE).
Two years later, we switched to the slf4j + JUL configuration, which is simpler and the only configuration point. This is not easy though (warning: tons of code follow):
logging.properties:
.level = INFO handlers = com.acme.log.InfoHandler,com.acme.log.ErrorHandler
InfoHandler.java:
public class InfoHandler extends StreamHandler { public InfoHandler() { setOutputStream(System.out); setFilter(new MaxLevelFilter(Level.WARNING)); } @Override public void publish(LogRecord record) { super.publish(record); flush(); } @Override public void close() { flush(); } }
ErrorHandler.java:
public class ErrorHandler extends StreamHandler { public ErrorHandler() { setOutputStream(System.err); } @Override public void publish(LogRecord record) { super.publish(record); flush(); } @Override public void close() { flush(); } }
MaxLevel.java:
public class MaxLevelFilter implements Filter { private final Level maxLevel; public MaxLevelFilter(Level level) { this.maxLevel = level; } @Override public boolean isLoggable(LogRecord record) { return maxLevel.intValue() > record.getLevel().intValue(); } }
You should also apply the workaround described here in some application sink when starting the server.
source share