Skip to content

Commit

Permalink
Set hibernate.show_sql to false as default
Browse files Browse the repository at this point in the history
Otherwise the log on CI becomes too big.

If you prefer to enable it while working,
in IDEA 2022.3.3, you can set
```
JAVA_TOOL_OPTIONS='-Dhibernate.show_sql=true'
```

in

Run > Edit Configurations > Edit Configuration Templates > Gradle > Environment Variables
  • Loading branch information
DavideD committed Mar 30, 2023
1 parent d628f60 commit 0a93be7
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ public static void setDefaultProperties(Configuration configuration) {
configuration.setProperty( Settings.HBM2DDL_IMPORT_FILES, "/db2.sql" );
doneTablespace = true;
}
//Use JAVA_TOOL_OPTIONS='-Dhibernate.show_sql=true'
configuration.setProperty( Settings.SHOW_SQL, System.getProperty( Settings.SHOW_SQL, "true" ) );
// Use JAVA_TOOL_OPTIONS='-Dhibernate.show_sql=true'
// Keep the default to false, otherwise the log on CI becomes too big
configuration.setProperty( Settings.SHOW_SQL, System.getProperty( Settings.SHOW_SQL, "false" ) );
configuration.setProperty( Settings.FORMAT_SQL, System.getProperty( Settings.FORMAT_SQL, "false" ) );
configuration.setProperty( Settings.HIGHLIGHT_SQL, System.getProperty( Settings.HIGHLIGHT_SQL, "true" ) );
}
Expand Down

3 comments on commit 0a93be7

@gavinking
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavideD I'm not sure I agree with this change. Wouldn't it have been better to leave SQL logging enabled by default, and explicitly disable it only in the CI?

@DavideD
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really that important? This was the configuration we used while working on 1.1 and nobody really complained.

@gavinking
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, important, perhaps not. But it's really very convenient to be able to immediately see the SQL emitted when I'm working on a test, or when I click on a failing test.

Please sign in to comment.