Spring Boot / Hibernate - 如何打开实体验证输出?

时间:2018-03-13 16:42:38

标签: hibernate jpa spring-boot

我在Spring Boot上收到此错误:

2018-03-13 13:39:26.663  WARN 6980 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory

我知道ORM上的错误。但我想知道哪一个。我有很多实体。可能一个映射是错误的。哪一个?

编辑 - 当前的logback.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<configuration packagingData="true">
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>
                %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n%ex{full, DISPLAY_EX_EVAL}
            </pattern>
        </encoder>
    </appender>
    <root level="debug">
        <appender-ref ref="STDOUT" />
    </root>
</configuration>

EDIT2:

尝试降级.pom上的logback降级

<properties>
    <logback.version>1.1.3</logback.version>
</properties>

没有运气。这似乎不是logback的问题。

1 个答案:

答案 0 :(得分:1)

根据logback's documentation,“%ex”应该用于输出完整的堆栈跟踪。配置应类似于:

 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%msg%n%ex{full, DISPLAY_EX_EVAL}</pattern>
    </encoder>
  </appender>