1

I have tried setting the log level of the Spring Boot application (via application.yml) to error.

logging:
  level:
    root: error
spring:
  jpa:
    show-sql: false
    hibernate:
      ddl-auto: update

However, I still see the hibernate generated queries being printed to stdout, example:

Hibernate: alter table mytable add column name varchar(255)

Is there anyway to disable this? I have tried the Hibernate log levels as well.

Thanks

7
  • Can you provide a minimum reproducible for it? Like pom.xml, application.yml and other logger configurations you have (for ex logback). Commented May 23, 2020 at 17:04
  • This isn't an error, simply run the Axon Framework in Spring Boot and it will output to the console. I am looking for a way to switch off the Hibernate logging. Apologies for my ignorance but I can't think of any other way to explain it. Commented May 24, 2020 at 18:12
  • Potentially this is a duplicate of this issue? stackoverflow.com/questions/36496178/… Commented May 25, 2020 at 13:56
  • Thanks Steven, I ran through all the potential configurations in that thread and came up empty. Is there not a flag being set in the auto configuration classes of the axon jpa setup? If you guys aren't doing it explicitly your side then it must be something on my side that I am missing. Commented May 26, 2020 at 15:57
  • That's bothersome, hope that would provide a hook for you to look at. Any how, Axon's auto configuration with JPA can be found in these two files: - github.com/AxonFramework/AxonFramework/blob/master/… - github.com/AxonFramework/AxonFramework/blob/master/… Commented May 27, 2020 at 9:28

1 Answer 1

0

The only way I managed to get this to stop spitting out SQL was to add the property at a code level.

private Properties additionalProperties(){
    var properties = new Properties();
    properties.setProperty("hibernate.show_sql", "false");
    properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
    return properties;
}

The portion containing the dialect was already there and I added the show_sql - I am not sure why the properties file was not doing this, perhaps

em.setJpaProperties(additionalProperties());

is overriding the properties set in the application properties file (which makes sense as it is a "set" call). Upon attempting to move the these values to the properties file and stop setting them in the config file the properties still weren't being set.

I am leaving this here as an explanation for anyone else that might have gone down the same rabbit hole as myself - should I make further progress on setting the values in the properties file I will share it here as well.

Thanks to everyone that reviewed this questions and those that tried to help

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.