You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ke...@indus.com on 2002/11/11 19:59:58 UTC

log4j logging config for a struts app - seeing struts msgs

Hi  - I am using Commons Logging/log4j in my struts app. When I added my
commons-logging.properties and log4j.properties to the classpath in my
struts webapp it enabled a huge amount of logging within the Struts
framework (ie I see loads of INFO and DEBUG messages from Struts framework
classes in addition to my own messages).

I don't understand enough about the logf4 config to configure this right.
I'm sure my config is too broad and that is why I am seeing all the
additional messages.

I tried setting the rootLogger level to ERROR which I though would restrict
the msgs, but this doesn't seem to have any effect.

I have also set the detail and debug values in web.xml to 0, but this
doesn't seem to have any effect either.

Heres the content of my log4j.properties:

log4j.rootLogger=ERROR

#define logger 'iaw_admin'
log4j.logger.iaw_admin=DEBUG, Console, Rolling

log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d{ISO8601}  %5p [%t]
(%F:%L) - %m%n

log4j.appender.Rolling=org.apache.log4j.RollingFileAppender
log4j.appender.Rolling.File=iaw_admin.log
log4j.appender.Rolling.MaxFileSize=10KB
log4j.appender.Rolling.MaxBackupIndex=1
log4j.appender.Rolling.layout=org.apache.log4j.PatternLayout
log4j.appender.Rolling.layout.ConversionPattern=%d{ISO8601}  %p %t %c -
%m%n

I'd like to restrict the logging to either a) only my classes (based on a
package name?), or b) only see errors from the logger I have configured
here, iaw_admin, and turn all other log msgs off.

Any ideas?

Thanks in advance, Kevin

****************************************
This email message and all attachments transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and
privileged information. Please DO NOT forward this email outside of the recipient's Company unless expressly authorized to do so herein.  Any
unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email
and destroy all copies of the original message.

Any views expressed in this email message are those of the individual sender except where the sender specifically states them to be the views of Indus
 International, Inc.
****************************************



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: log4j logging config for a struts app - seeing struts msgs

Posted by Robert <rm...@bull-enterprises.com>.
Try adding something along the lines of this to your log4j.properties file:

log4j.logger.org.apache=WARN (or ERROR, etc.)

Which means that the packages org.apache and below will log at level 
WARN, ERROR, etc.

You can also specify complete class names like:

log4j.logger.org.apache.struts.actions.Action=(level)

HTH,
Robert

Kevin.Hooke@indus.com wrote:

>Hi  - I am using Commons Logging/log4j in my struts app. When I added my
>commons-logging.properties and log4j.properties to the classpath in my
>struts webapp it enabled a huge amount of logging within the Struts
>framework (ie I see loads of INFO and DEBUG messages from Struts framework
>classes in addition to my own messages).
>
>I don't understand enough about the logf4 config to configure this right.
>I'm sure my config is too broad and that is why I am seeing all the
>additional messages.
>
>I tried setting the rootLogger level to ERROR which I though would restrict
>the msgs, but this doesn't seem to have any effect.
>
>I have also set the detail and debug values in web.xml to 0, but this
>doesn't seem to have any effect either.
>
>Heres the content of my log4j.properties:
>
>log4j.rootLogger=ERROR
>
>#define logger 'iaw_admin'
>log4j.logger.iaw_admin=DEBUG, Console, Rolling
>
>log4j.appender.Console=org.apache.log4j.ConsoleAppender
>log4j.appender.Console.layout=org.apache.log4j.PatternLayout
>log4j.appender.Console.layout.ConversionPattern=%d{ISO8601}  %5p [%t]
>(%F:%L) - %m%n
>
>log4j.appender.Rolling=org.apache.log4j.RollingFileAppender
>log4j.appender.Rolling.File=iaw_admin.log
>log4j.appender.Rolling.MaxFileSize=10KB
>log4j.appender.Rolling.MaxBackupIndex=1
>log4j.appender.Rolling.layout=org.apache.log4j.PatternLayout
>log4j.appender.Rolling.layout.ConversionPattern=%d{ISO8601}  %p %t %c -
>%m%n
>
>I'd like to restrict the logging to either a) only my classes (based on a
>package name?), or b) only see errors from the logger I have configured
>here, iaw_admin, and turn all other log msgs off.
>
>Any ideas?
>
>Thanks in advance, Kevin
>
>****************************************
>This email message and all attachments transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and
>privileged information. Please DO NOT forward this email outside of the recipient's Company unless expressly authorized to do so herein.  Any
>unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email
>and destroy all copies of the original message.
>
>Any views expressed in this email message are those of the individual sender except where the sender specifically states them to be the views of Indus
> International, Inc.
>****************************************
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>  
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>