【问题标题】:spring batch debug logs春季批处理调试日志
【发布时间】:2018-04-03 13:27:32
【问题描述】:

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

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.

【问题讨论】:

  • 那些日志说他们是。你还期待什么?
  • 创建 SQL 日志,因为我在数据库中没有看到表
  • 我相信 Spring 没有这种能力。您需要查看您的数据库日志。脚本肯定是运行的。你确定你正在寻找正确的数据库?
  • 谢谢。这是 AWS mysql 中的绑定问题

标签: spring spring-batch


【解决方案1】:

确认以下事项:

如果您在 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

【讨论】:

    猜你喜欢
    • 2016-09-24
    • 2014-12-15
    • 2018-05-27
    • 2015-05-13
    • 2017-06-25
    • 2017-10-06
    • 2018-02-08
    • 2021-06-21
    • 1970-01-01
    相关资源
    最近更新 更多