wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes what does log4j info level mean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "what does log4j info level mean" Watch "what does log4j info level mean" New topic
Author

what does log4j info level mean

Archana Annamaneni
Ranch Hand

Joined: Jan 29, 2003
Posts: 147
hi ,

I have configured my log4j propertis file as following

log4j.rootLogger=info, R

log4j.appender.R=org.apache.log4j.FileAppender
log4j.appender.R.File=/usr/local/jakarta-tomcat-4.1.30/logs/xmlgateway/xmlgatewaylog.log

log4j.appender.R.layout=org.apache.log4j.SimpleLayout

And in one my Struts Action classes
I included some
log.info("xxxxxx")statements.

But the log file has these other info messages also , how do i avoid these?

INFO - Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
INFO - Initializing, config='org.apache.struts.action.ActionResources', returnNull=true

what should i do to include only my own log statemens.

Thanks
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
You set up your root logger at info level using "R" appender; this means that all log4j logging will go that appender including third party products.

You can do the following

1. put a logger in your properties file for the struts package such as "log4j.logger.org.apache.struts"

2. with the struts logger using a different appender and/or set to a different level

# only warnings or higher logging to a different appender (you would
# need to define that different appender)
log4j.logger.org.apache.struts=warn,STRUTS

# same appender, higher level
log4j.logger.org.apache.struts=warn,R

3. and you need to turn off additivity on the struts logging
log4j.additivity.org.apache.struts=false

The additivity part says for this logger, don't log to appenders attached to any loggers up the hierarchy (root logger in this case). This is important to keep from getting duplicate messages.

If you're just getting struts set up in your project it is good to keep the struts logging turned on (but to a different appender so that it doesn't clutter up your logging) so you can see what might be going wrong with the struts setup.

Check out the log4j manual for syntax and more explanation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what does log4j info level mean
 
Similar Threads
Inexplicable error
returnNull=true
action not found
some questions when tomcat starts
how to filter log messages while using log4j ?