Skip to content

Commit

Permalink
Improve how to enable SQL query logging for develop mode (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteDev2 authored Jan 29, 2024
1 parent f3d4588 commit a97a1a0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ public void setLocation(String location) {

private boolean enableScopeAuthz = true;

private boolean showSql = false;

private LocalResources localResources = new LocalResources();

private Logo logo = new Logo();
Expand Down Expand Up @@ -615,6 +617,14 @@ public void setEnableScopeAuthz(boolean enableScopeAuthz) {
this.enableScopeAuthz = enableScopeAuthz;
}

public boolean isShowSql() {
return showSql;
}

public void setShowSql(boolean showSql) {
this.showSql = showSql;
}

public LoginButtonProperties getLoginButton() {
return loginButton;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ public class JpaConfig extends JpaBaseConfiguration {

public static final String ECLIPSELINK_LOGGING_LEVEL = "eclipselink.logging.level";
public static final String ECLIPSELINK_LOGGING_LEVEL_SQL = "eclipselink.logging.level.sql";
public final IamProperties iamProperties;

protected JpaConfig(DataSource dataSource, JpaProperties properties,
ObjectProvider<JtaTransactionManager> jtaTransactionManager) {
ObjectProvider<JtaTransactionManager> jtaTransactionManager, IamProperties iamProperties) {
super(dataSource, properties, jtaTransactionManager);
this.iamProperties = iamProperties;
}

@Autowired
Expand All @@ -68,7 +70,7 @@ protected Map<String, Object> getVendorProperties() {
map.put(ECLIPSELINK_LOGGING_LEVEL_SQL, "OFF");
map.put("eclipselink.cache.shared.default", "false");

if (System.getProperty("iam.show_sql") != null) {
if (iamProperties.isShowSql()) {
map.put(ECLIPSELINK_LOGGING_LEVEL, "FINE");
map.put(ECLIPSELINK_LOGGING_LEVEL_SQL, "FINE");
map.put("eclipselink.logging.parameters", "true");
Expand Down
2 changes: 1 addition & 1 deletion iam-login-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ spring:
pathmatch:
matching-strategy: "ant-path-matcher"
iam:

host: ${IAM_HOST:localhost}
baseUrl: ${IAM_BASE_URL:http://${iam.host}:8080}
issuer: ${IAM_ISSUER:http://${iam.host}:8080}
topbarTitle: ${IAM_TOPBAR_TITLE:INDIGO IAM for ${iam.organisation.name}}
showSql: ${IAM_DATABASE_SHOW_SQL:false}

jwk:
keystore-location: ${IAM_KEY_STORE_LOCATION:classpath:keystore.jwks}
Expand Down

0 comments on commit a97a1a0

Please sign in to comment.