Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot see any comments in the logs when using Java with Spring Boot and Hibernate #134

Open
johanhaleby opened this issue May 31, 2022 · 0 comments

Comments

@johanhaleby
Copy link

Hi,

I'm experimenting with SQL Commenter for Java (using version 2.0.1). We're using Spring Boot 2.7.0 and Hibernate (the version that ships with spring boot) and I've followed the instructions here. I.e. I've added:

@Configuration
MyConfigurer implements WebMvcConfigurer {
	
   @Bean
    public SpringSQLCommenterInterceptor sqlInterceptor() {
         return new SpringSQLCommenterInterceptor();
    }
 
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(sqlInterceptor());
    }
  
}

and added

properties.setProperty("hibernate.session_factory.statement_inspector", SCHibernate.class.getName());

to our Hibernate configuration.

Then I've started MySQL (5.6) in Docker and enabled logging:

 SET GLOBAL general_log = 'ON';

If I run SHOW VARIABLES LIKE "general_log%"; I see this:

+------------------+---------------------------------+
| Variable_name    | Value                           |
+------------------+---------------------------------+
| general_log      | ON                              |
| general_log_file | /var/lib/mysql/fb28ada36c57.log |
+------------------+---------------------------------+

When I log into the container and tail the log I see a lot SQL queries but I don't see any comments that I expect to see with sql-commenter.

What am I doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant