• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts1.1 And Log4j

 
Sahil Singh
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys have a problem.

AM using Log4j for logging with Struts1.1.

When i start up the application.

It start with atleast "4 minutes ANNOYING " logging outputs.....

And then runs fine..

Is there any way i can stop this unwanted log outputs...


Following is the files i have:-


log4j.properties:-

##################
log4j.rootLogger=debug, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
##################


Loading it in web.xml:-

##################
<init-param>
<param-name>log4j.properties</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</init-param>
##################

Also if i edit anything (using wsad4.0.3)ans save it,again it start the annoying "debug logs" for another 3-4 minutes...

Is something else i have to do?

Thanks In advance,
Sahil
[ June 18, 2004: Message edited by: Sahil Singh ]
 
Sahil Singh
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically testing further i did

import org.apache.log4j.Logger;

Class defination...etc

Logger logger = Logger.getLogger(CLASSABCDAction.class);



System.out.println(logger.getEffectiveLevel()); gives me "DEBUG";

but the next line : logger.debug("TESTING DEBUG"); is not printed


Please advice,
Thanks,
Sahil
[ June 18, 2004: Message edited by: Sahil Singh ]
 
Sahil Singh
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or i would say in other words,
Is there any way to Stop the DEBUG outputs of Struts1.1 and only allow DEBUGS
of one written in my application.

Thanks,
Sahil
[ June 20, 2004: Message edited by: Sahil Singh ]
 
Sriram Chandrasekaran
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well just specify a different logger for all apache struts stuff

add something like

log4j.logger.org.apache=WARN
in your log4j config file to suppress log4j debug statements...what this will do is log4j will use this logger for all classed in pkg starting with org.apache

-sri
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic