HI,
In our web application it prints all the logs are printed like Spring and JSF jars files. Which not required for us. How can I set in the log4j.xml file to filte
You need to define the own logger and appender for your application.
For example, if you need to log the trace message in com.xyz.http.RequestFilter
:
log4j.com.xyz.http.RequestFilter=TRACE, TRACE_APPEND
log4j.appender.TRACE_APPEND=org.apache.log4j.RollingFileAppender
log4j.appender.TRACE_APPEND.File=example.log
log4j.appender.TRACE_APPEND.MaxFileSize=100KB
log4j.appender.TRACE_APPEND.MaxBackupIndex=1
log4j.appender.TRACE_APPEND.layout=org.apache.log4j.PatternLayout
log4j.appender.TRACE_APPEND.layout.ConversionPattern=%p %t %c - %m%n
See more at log4j official manual http://logging.apache.org/log4j/1.2/manual.html
Log only warning for Spring :
<logger name="org.springframework">
<level value="warn"/>
<appender-ref ref="socket"/>
<appender-ref ref="stdout"/>
</logger>
Same for JSF with the jsf package name...
javax.faces
, org.apache.myfaces
, com.sun.faces
etc... also, the appender-ref refers to your appenders...