我已经将spring batch admin与现有的spring web应用程序集成在一起。我可以使用批处理管理屏幕触发/控制作业,并使用Tomcat8进行部署。一切正常,但Spring管理批处理日志在控制台中触发,导致catalina.out填入GB。 示例日志如下:
DEBUG o.s.jdbc.core.JdbcTemplate - Executing SQL query [SELECT distinct JOB_NAME from BATCH_JOB_INSTANCE order by JOB_NAME]
DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
DEBUG o.s.jdbc.core.JdbcTemplate - Executing SQL query [SELECT distinct JOB_NAME from BATCH_JOB_INSTANCE order by JOB_NAME]
DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL query
DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement [SELECT COUNT(1) from BATCH_JOB_EXECUTION E, BATCH_JOB_INSTANCE I where E.JOB_INSTANCE_ID=I.JOB_INSTANCE_ID and I.JOB_NAME=?]
和我的log4j配置如下:
<logger name="org.springframework" additivity="false" >
<level value="WARN" />
<appender-ref ref="DailyRollingFileAppender"/>
</logger>
<logger name="org.springframework.jdbc" additivity="false" >
<level value="WARN" />
<appender-ref ref="DailyRollingFileAppender"/>
</logger>
<logger name="org.springframework.web" additivity="false" >
<level value="WARN" />
<appender-ref ref="DailyRollingFileAppender"/>
</logger>
<logger name="org.springframework.batch" additivity="false" >
<level value="WARN" />
<appender-ref ref="DailyRollingFileAppender"/>
</logger>
<logger name="org.springframework.batch.admin" additivity="false" >
<level value="WARN" />
<appender-ref ref="DailyRollingFileAppender"/>
</logger>
但我正在不断获取日志。你能否建议如何禁用/提高日志级别?提前谢谢。
答案 0 :(得分:0)
我已按照以下链接的建议创建了logback.xml,它就像魅力!!
Change Spring framework log level in simple example project?