• Post Reply Bookmark Topic Watch Topic
  • New Topic

what does log4j info level mean  RSS feed

Archana Annamaneni
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,

I have configured my log4j propertis file as following

log4j.rootLogger=info, R



And in one my Struts Action classes
I included some

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.

Carol Enderlin
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)

# same appender, higher level

3. and you need to turn off additivity on the struts logging

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.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!