简体   繁体   English

春季批调试日志

[英]spring batch debug logs

I am unable to log the spring batch logs in spring boot application which uses JPA. 我无法在使用JPA的spring boot应用程序中记录spring batch日志。 Here is the properties file configuration (application.properties). 这是属性文件配置(application.properties)。 I want to see if application has created spring batch table from the logs. 我想查看应用程序是否已从日志中创建spring批处理表。

https://github.com/spring-projects/spring-batch/blob/master/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-mysql.sql 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

And here are the logs : 这是日志:

[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.

Confirm the following things: 确认以下事项:

If you are providing datasource in Spring properties, make sure the setting are correct and you are checking at correct place 如果要在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

If you are binding a service, make sure the setting are fine and and it is correctly bind, and spring is using that database. 如果要绑定服务,请确保设置正确且已正确绑定,并且spring正在使用该数据库。 If you are using PCF, check this link . 如果您使用的是PCF,请检查此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM