Spring boot 在spring引导中禁用SQL异常日志记录数据
我们正在使用hibernate批处理。如果为批处理接收的输入数据大小大于数据库中指定的大小,则抛出包含所有数据值的行详细信息的错误。 例如:Spring boot 在spring引导中禁用SQL异常日志记录数据,spring-boot,hibernate,jpa,spring-data-jpa,Spring Boot,Hibernate,Jpa,Spring Data Jpa,我们正在使用hibernate批处理。如果为批处理接收的输入数据大小大于数据库中指定的大小,则抛出包含所有数据值的行详细信息的错误。 例如: 2021-05-11 08:13:43.196 ERROR 1 --- [ main] o.h.e.jdbc.batch.internal.BatchingBatch : HHH000315: Exception executing batch [java.sql.BatchUpdateException: Batch entry 0
2021-05-11 08:13:43.196 ERROR 1 --- [ main] o.h.e.jdbc.batch.internal.BatchingBatch : HHH000315: Exception executing batch [java.sql.BatchUpdateException: Batch entry 0 insert into testschema.testdata (created_by, created_date, date_of_birth, gender) values ('2021-05-11 08:13:42.986+00', '2021-05-11 08:13:42.986+00','2000-12-31 00:00:00+00', 'Male') was aborted: ERROR: value too long for type character varying(15) Call getNextException to see other errors in the batch.], SQL: insert into testschema.testdata (created_by, created_date, date_of_birth, gender)values (?, ?, ?, ?)
由于安全原因,我们不希望打印数据
我曾尝试设置以下属性,但没有任何效果
server.error.include-stacktrace=never
logging.level.org.hibernate.SQL=OFF
logging.level.org.hibernate.type=OFF
hibernate.show_sql= false
spring.jpa.properties.hibernate.show_sql=false
如何防止在错误日志中打印数据?
我们正在使用lombok slf4j注释进行应用程序日志记录