struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brown, Melonie S. - Contractor" <Melonie.Br...@forscom.army.mil>
Subject Struts & Tiles & Validator Logging
Date Fri, 07 Mar 2003 15:14:06 GMT
I have noticed a number of posts by people asking how to restrict the
logging for struts/tiles/validator and have noticed responses ranging from
RTFM to detailed info with sample log4j properties files.  

Wishing to reduce the verbosity of the logs, I downloaded the latest log4j
jar, added it in to my lib folder and to the project library, created a
log4j.properties file and commons-logging.properties file and placed both
into my src folder so they would be in my classpath (I'm using Eclipse, so
it gets copied to the classes folder).  I used the properties files from
Eddie Bush's posting (at the end of post), rebuilt my project, fired up
Tomcat and *voila* the log messages continued to spew.  

Trying to cover all of my bases,  I went to the Struts website and looked
under the FAQ's and HowTo's.  None of these documents address logging.  I
then went to the User & Developer Guides.  Section 4.10 says that Struts
uses commons logging and has a link to the commons section of the jakarta
site, but no details on how to configure for Struts.

The Learning More About Struts section of the Jakarta site has a link to the
BaseBeans NewsGroup version of the Struts mailing list - but the Basebeans
server has been down since last fall, so the link doesn't work.  [Suggestion
- change to news.gmane.org]. No wonder this question gets asked so
frequently!  Anyway, what steps am I missing in configuring the logging?
I'm using Struts 11B3.

Eddie Bush wrote:
> You really should be able to get such examples off the components' 
> respective sites, but, seeing as how folks seem to have problems with 
> this ... here you go :-)
> 
> log4j.properties <---
> log4j.rootLogger=DEBUG,A1
> log4j.logger.org.apache.struts.tiles=WARN
> 
> # A1 is set to be a ConsoleAppender.
> log4j.appender.A1=org.apache.log4j.ConsoleAppender
> 
> # A1 uses PatternLayout.
> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
> 
> commons-logging.properties <---
>
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jF
actory 
> 
> 
> The commons-logging.properties file says "Hey, commons-logging, I'm 
> using Log4J as my logging implementation!".  From there, you just need 
> to configure Log4J to your needs.  If you need more sophisticated 
> control over Log4J, see the Log4J site:  http://jakarta.apache.org/log4j
<http://jakarta.apache.org/log4j> 
> 
> Enjoy! ;-)
> 
> Rieberger, Dale wrote:
> 
>> Need an example of a commons-logging.properties and log4j.properties 
>> files.
>>
> 

Mime
View raw message