SLF4J on Java Google App Engine

This article suggest a recipe to configure SLF4J on Google App Engine for Java.

This article was first published at techtavern.wordpress.com

Google App Engine for Java offers a restricted Java 6 API, which includes just the cumbersome Java Utils Logging. Fortunately, SLF4J works as well. The recipe is the standard one. Nearly no configuration is required.

Just add following SLF4J libraries into the applications WEB-INF/lib directory: slfj4-api-1.7.7.jar and slf4j-jdk14-1.7.7.jar (version number may vary). This will redirect all your SLF4J logging statements to the Java Utils Logging controlled by the App Engine.

Optionally you may also add jcl-over-slf4j-1.7.7.jar and log4j-over-slf4j-1.7.7.jar libraries, that will redirect both Apache Commons Logging and Log4J to SLF4J (and thus to App Engine’s Java Utils Logging).