You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Maarten Coene <Ma...@ToughGuy.net> on 2001/08/07 16:32:17 UTC

log4j and J2EE problem

Hi,

I want to use Log4J in my J2EE application, but I cannot manage to get 
started with it: even a simple logging to the system.out doesn't seem to 
work :-(

This is how I tried to do it:
1. I've created following configuration file named log4j.properties

# Set root category priority to DEBUG and its only appender to the system.out
log4j.rootCategory=DEBUG, stdout

#test
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

2. I've placed this file somewhere in the classpath so my J2EE application 
can find it.
3. I've put this code in a servlet source file (just to test if it works)

public class MainServlet extends HttpServlet {

     private transient static Category cat = 
Category.getInstance(MainServlet.class.getName());

     /** Perform first-call initialization for the MainServlet */
     public void init() {
         cat.info("Initializing MainServlet");
         ...
     }
}

When I deploy my application and the servlet got initialized, nothing is 
written to my system.out by log4j (nor is anything written to the 
system.err indicating some errors). Could someone tell me what I'm doing 
wrong here?

thx
Maarten

--
Maarten Coene
Katholieke Universiteit Leuven
Dept. Computerwetenschappen             Tel: ++32 (0)16/32 78 25
Celestijnenlaan 200A
B-3001 Heverlee



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org