spring批量调试日志

时间:2017-10-23 04:17:42

标签: spring spring-batch

我无法在使用JPA的spring boot应用程序中记录spring批处理日志。这是属性文件配置(application.properties)。我想看看应用程序是否已从日志中创建了弹出批处理表。

https://github.com/spring-projects/spring-batch/blob/master/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-mysql.sql

spring.jpa.hibernate.ddl-auto=update

#show sql statement
logging.level.org.hibernate.SQL=debug
#show sql values
logging.level.org.hibernate.type.descriptor.sql=debug
log4j.category.org.springframework.jdbc.core = debug
spring.jpa.show-sql=true

spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.format_sql=true


log4j.logger.org.springframework.jdbc=DEBUG
log4j.logger.org.springframework.batch=DEBUG

以下是日志:

[2m2017-10-23 15:10:33.624[0;39m [32m INFO[0;39m [35m10092[0;39m [2m--
-[0;39m [2m[           main][0;39m 
 [36mo.s.jdbc.datasource.init.ScriptUtils    [0;39m [2m:[0;39m Executing SQL script from class path resource [org/springframework/batch/core/schema-mysql.sql]
[2m2017-10-23 15:10:35.988[0;39m [32m INFO[0;39m [35m10092[0;39m [2m--
-[0;39m [2m[           main][0;39m 
[36mo.s.jdbc.datasource.init.ScriptUtils    [0;39m [2m:[0;39m Executed SQL script from class path resource [org/springframework/batch/core/schema-mysql.sql] in 2363 ms.

1 个答案:

答案 0 :(得分:0)

确认以下事项:

如果您在Spring属性中提供数据源,请确保设置正确并且您正在检查正确的位置

spring.datasource.url = jdbc:mysql://localhost/test
spring.datasource.username = dbuser
spring.datasource.password = dbpass
spring.datasource.driver-class-name = com.mysql.jdbc.Driver

如果要绑定服务,请确保设置正常并且正确绑定,并且spring正在使用该数据库。如果您使用的是PCF,请查看link