You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Apache Wiki <wi...@apache.org> on 2005/11/16 17:02:05 UTC

[Struts Wiki] Update of "StrutsLogging" by FrankZammetti

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Struts Wiki" for change notification.

The following page has been changed by FrankZammetti:
http://wiki.apache.org/struts/StrutsLogging

New page:
One of the oft-repeated complaints about Struts is that it doesn't emit a great deal of logging.  This is actually not true, there's more being emitted than meets the eye.

Struts uses Jakarta Commons Logging (JCL) for its logging functions.  JCL of course uses an underlying logging implementation to do the real work, something like Log4J or J2EE logging typically.  While it is possible to configure the underlying logging implementation to see more Struts messages, there is a quick-and-dirty way that is of great interest during debugging, especially when you are experiencing a webapp that just won't start up properly.

Simply create two text files in your webapp's WEB-INF/classes folder named commons-logging.properties and simplelog.properties.

In commons-logging.properties, put the following content:

org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog

In simplelog.properties, put the following content:

org.apache.commons.logging.simplelog.defaultlog=debug 

Now start your webapp and you will see probably more logging messages than you would ever want!  I use this in Tomcat all the time where I start Tomcat with startup.bat, so I see everything scrolling by in the console window.  Things like struts-config parse errors will become quite apparent with this.

You can set the logging level a little higher, to error perhaps, which still gives a lot of useful messages, but not quite as many.

Note that at least in Tomcat, you will see *A TON* of messages because Tomcat itself will now show its logging messages too.  Like I said, it's probably *more* than you'll actually want!  

But, you'll never complain about Struts not giving enough error messages again :)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org