Log4j, Wicket, Tomcat, and NetBeans IDE

I'm getting acquainted with Wicket (which I blogged about here). In doing so, I encountered some problems and got a few responses from Wicket's mailing list. Someone suggested that I use Log4j to debug my issues, and so -- for the first time -- I used Log4j today. So here, as a reminder to myself and possibly of benefit to others, is what I did to use Log4j for debugging a Wicket application deployed over Tomcat from NetBeans IDE:

  1. Stop the running Tomcat instance. (In the IDE's Runtime window.)
  2. Download Commons Logging and copy the JAR to Tomcat's common/lib folder.
  3. Download Log4j and copy the JAR to Tomcat's common/lib folder.
  4. Create a log4j.properties file in Tomcat's common/classes folder. Make sure it contains the following line:

    log4j.logger.wicket.util.resource=DEBUG

    The above line is only for the resource package. To enable debugging for all the Wicket packages, use this instead:

    log4j.logger.wicket=DEBUG

    This is my log4j.properties file. Make sure that you change the log4j.appender.R.File property to point to logs/tomcat.log file in Tomcat's base directory (which is inside the NetBeans IDE user directory).

  5. Deploy the Wicket application. (In the IDE's Projects window.)
  6. Go to the logs/tomcat.log file in Tomcat's base directory and, if errors have been picked up, note that there are lines such as the following:

    2005-07-02 20:41:25,140 [http-8084-Processor23] 
    DEBUG wicket.util.resource.locator.ResourceStreamLocator - 
    Attempting to locate resource 'wicket/examples/navomatic/Page1.html' 
    on path [folders = [\\], webapppaths: []]

Finally, I've found this document to be very helpful in setting up Log4j for Tomcat: Logging for Apache Tomcat and Velocity using Log4j

Comments:

then you may be interested in this : http://flexo.cismet.de/gadgets/nbm4lm/ a nice netbeans plugins that shows log4j lgos in a filterable pane within netbeans. Unfortunately it seems to be based on lumbermill, which isn't quite a full featured as sawmill - it would be really, really nice to have a sawmill plugin as part of the netbeans standard install....

Posted by guest on July 05, 2005 at 05:34 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today