Question

I'm working on a Strus2+iBatis project.

When I config the log4j.properties for my project in WEB-INF/classes/...

the iBatis and Struts2 show it's debug information. but sometimes I only want to see my code's log.

I know there is a Hierrachy Logger object in my project. so quesiton is:

1, Is my RootLogger alse the root logger of the iBatis and Struts2 ?

2, How to swith off those 3rd lib's log information?

3, In which way the log4j put my logger in the Hierrachy ? (I guess is: if the logger name is "com.domain.proj.pkg" then log4j will create "com"->"domain"->"proj" 3 namespace and put my logger "pkg" in this namespace)

Was it helpful?

Solution

Update the log4j configuration file to set the log level for Struts2 and iBatis packages to WARN. Following is the settings for Struts2 packages. Similarly add iBatis packages to the list.

log4j.logger.com.opensymphony.xwork2=WARN
log4j.logger.ognl=WARN
log4j.logger.org.apache=WARN
log4j.logger.org.apache.struts2=WARN
log4j.logger.org.apache.struts2.util.StrutsTypeConverter=WARN

If your log4j configuration is a xml file, you will need to add the struts2 and iBatis packages as below.

<logger name="com.opensymphony.xwork2" additivity="false">
   <level value="WARN" />
   <appender-ref ref="fileappender" />
</logger>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top