Java Log4J, SLF4J logging in Java EE application

Java Log4J, SLF4J logging Java EE application in Eclipse.

Be sure to check first screencast Logging using Log4j and SLF4J in Java SE application, because in this screencast it is expected that you are familiar with basics.

First we must add three jars - log4j, slf4j-api and slf4j-log4j to classpath. Copy them to WEB-INF/lib folder.

Next we must add log4j to classpath. Put it to src folder.

Rest is the same as with Java SE application. In a class where you want to use logging, you must create a logger attribute and then you log using debug/trace/info/warn/error methods from Logger class.