Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

INFO logging in Struts 1.3.10

 
Steve Dambrosio
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm upgrading to Struts 1.3.10 from 1.1 (yikes) and to tomcat 6.0 from tomcat 4.1. I got it working but I'm no longer getting some INFO log messages that I've found to be useful. For example:
INFO: Processing a 'POST' for path '/Welcome'

Does anyone know how to get these back (if possible)? BTW, I'm getting other INFO type messages just fine, for example "INFO: Tiles definition factory found for request processor '', so I don't think this has to do with the LEVEL of logging. Perhaps I need to tell Struts to be more verbose. Thanks!
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tomcat6.x from 4.x really needs efforts for sure ! actually it is less compare to websphere6.x to websphere7.x what i believe!
 
Steve Dambrosio
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone assist on my original post? Thanks.
 
Steve Dambrosio
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The solution is to configure Struts logging to use Log4J as its logging implementation. This will allow you to configure the level of logging that you want. BTW, in struts 1.3 the message "Processing a 'POST' for path '/mypath'" is a DEBUG level message. The following might not be the very best practice, but I think it's a good start:

1. Download the Log4J jar file from http://jakarta.apache.org/log4j.

2. Copy the jar file to your application's WEB-INF/lib folder.

3. Create a log4j.properties file (note: I've read that creating a log4j.xml file instead is the new and improved method). In this example I write log messages in two different formats, one for my application messages and another for struts (and everything else). I decided to log DEBUG messages for the struts RequestProcessor.


4. Configure Commons Logging to use Log4J in the commons-logging.properties file as follows:


5. Place both files in your application's WEB-INF/classes folder (at this level, not in a subfolder). If you're using eclipse, but it right under the src folder and eclipse will automatically put it into WEB-INF/classes.

Hope this works!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic