Skip to content
This repository was archived by the owner on Oct 24, 2020. It is now read-only.

Commit bf9796f

Browse files
authored
Replace DomaLogger with Slf4jJdbcLogger (#53)
1 parent 649e667 commit bf9796f

File tree

10 files changed

+29
-299
lines changed

10 files changed

+29
-299
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ quarkus.doma.fetch-size=50
4040
quarkus.doma.max-rows=500
4141
quarkus.doma.query-timeout=5000
4242
quarkus.doma.sql-load-script=import.sql
43-
quarkus.doma.log.sql=false
44-
quarkus.doma.log.dao=false
45-
quarkus.doma.log.closing-failure=false
4643
```
4744

4845
The above properties are all optional.

deployment/src/main/java/org/seasar/doma/quarkus/deployment/DomaBuildTimeConfig.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ public class DomaBuildTimeConfig {
5151
@ConfigItem(defaultValue = "none")
5252
public SqlLogType exceptionSqlLogType;
5353

54-
/** The log configuration. */
55-
@ConfigItem public LogBuildTimeConfig log;
56-
5754
@ConfigGroup
5855
public static class DataSourceBuildTimeConfig {
5956
/**
@@ -128,31 +125,6 @@ public String toString() {
128125
}
129126
}
130127

131-
@ConfigGroup
132-
public static class LogBuildTimeConfig {
133-
134-
/** Shows SQL logs. */
135-
@ConfigItem public boolean sql;
136-
137-
/** Shows DAO logs. */
138-
@ConfigItem public boolean dao;
139-
140-
/** Shows the logs of the failure to close JDBC resource. */
141-
@ConfigItem public boolean closingFailure;
142-
143-
@Override
144-
public String toString() {
145-
return "DomaConfigurationLog{"
146-
+ "sql="
147-
+ sql
148-
+ ", dao="
149-
+ dao
150-
+ ", closingFailure="
151-
+ closingFailure
152-
+ '}';
153-
}
154-
}
155-
156128
@Override
157129
public String toString() {
158130
return "DomaBuildTimeConfig{"
@@ -166,8 +138,6 @@ public String toString() {
166138
+ naming
167139
+ ", exceptionSqlLogType="
168140
+ exceptionSqlLogType
169-
+ ", log="
170-
+ log
171141
+ '}';
172142
}
173143
}

deployment/src/main/java/org/seasar/doma/quarkus/deployment/DomaSettingsFactory.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ DomaSettings create() {
4242
settings.naming = buildTimeConfig.naming;
4343
settings.exceptionSqlLogType = buildTimeConfig.exceptionSqlLogType;
4444
settings.dataSources = dataSources();
45-
settings.log = log();
4645
if (dataSources.isEmpty()) {
4746
throw new IllegalStateException("The quarkus.datasource is empty. Specify it.");
4847
}
@@ -147,9 +146,4 @@ private String resolveSqlLoadScript(Optional<String> sqlLoadScript) {
147146
}
148147
}
149148
}
150-
151-
private DomaSettings.LogSettings log() {
152-
var log = buildTimeConfig.log;
153-
return new DomaSettings.LogSettings(log.sql, log.dao, log.closingFailure);
154-
}
155149
}

deployment/src/test/java/org/seasar/doma/quarkus/deployment/ApplicationPropertiesTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.seasar.doma.jdbc.Config;
1616
import org.seasar.doma.jdbc.Naming;
1717
import org.seasar.doma.jdbc.SqlLogType;
18-
import org.seasar.doma.quarkus.runtime.DomaLogger;
1918

2019
public class ApplicationPropertiesTest {
2120

@@ -47,7 +46,6 @@ public class ApplicationPropertiesTest {
4746
"application.properties"));
4847

4948
@Inject Config config;
50-
@Inject DomaLogger domaLogger;
5149

5250
@Test
5351
public void test() {
@@ -61,9 +59,5 @@ public void test() {
6159
assertEquals(20, config.getFetchSize());
6260
assertEquals(30, config.getMaxRows());
6361
assertEquals(40, config.getQueryTimeout());
64-
65-
assertTrue(domaLogger.getLogPreferences().isSql());
66-
assertTrue(domaLogger.getLogPreferences().isDao());
67-
assertTrue(domaLogger.getLogPreferences().isClosingFailure());
6862
}
6963
}

quarkus-doma.adoc

Lines changed: 21 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.dialect]]`lin
1313
[.description]
1414
--
1515
The SQL dialect.
16-
--|`db2`, `h2`, `mssql`, `mysql`, `oracle`, `postgres`, `standard`, `sqlite`
16+
--|`db2`, `h2`, `mssql`, `mysql`, `oracle`, `postgres`, `standard`, `sqlite`
1717
|`depends on 'quarkus.datasource.db-kind'`
1818

1919

@@ -22,7 +22,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.batch-size]]`
2222
[.description]
2323
--
2424
The batch size.
25-
--|int
25+
--|int
2626
|`0`
2727

2828

@@ -31,7 +31,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.fetch-size]]`
3131
[.description]
3232
--
3333
The fetch size.
34-
--|int
34+
--|int
3535
|`0`
3636

3737

@@ -40,7 +40,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.max-rows]]`li
4040
[.description]
4141
--
4242
The max rows.
43-
--|int
43+
--|int
4444
|`0`
4545

4646

@@ -49,17 +49,17 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.query-timeout
4949
[.description]
5050
--
5151
The query timeout limit in seconds.
52-
--|int
52+
--|int
5353
|`0`
5454

5555

5656
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.sql-load-script]]`link:#quarkus-doma_quarkus.doma.sql-load-script[quarkus.doma.sql-load-script]`
5757

5858
[.description]
5959
--
60-
Name of the file containing the SQL statements to execute when Doma starts. Its default value differs depending on the Quarkus launch mode:
61-
* In dev and test modes, it defaults to `import.sql`. Simply add an `import.sql` file in the root of your resources directory and it will be picked up without having to set this property. Pass `no-file` to force Doma to ignore the SQL import file. * In production mode, it defaults to `no-file`. It means Doma won't try to execute any SQL import file by default. Pass an explicit value to force Doma to execute the SQL import file.
62-
--|string
60+
Name of the file containing the SQL statements to execute when Doma starts. Its default value differs depending on the Quarkus launch mode:
61+
++*++ In dev and test modes, it defaults to `import.sql`. Simply add an `import.sql` file in the root of your resources directory and it will be picked up without having to set this property. Pass `no-file` to force Doma to ignore the SQL import file. ++*++ In production mode, it defaults to `no-file`. It means Doma won't try to execute any SQL import file by default. Pass an explicit value to force Doma to execute the SQL import file.
62+
--|string
6363
|`import.sql in DEV, TEST ; no-file otherwise`
6464

6565

@@ -68,7 +68,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.sql-file-repo
6868
[.description]
6969
--
7070
The SQL file repository.
71-
--|`no-cache`, `greedy-cache`
71+
--|`no-cache`, `greedy-cache`
7272
|`greedy-cache`
7373

7474

@@ -77,7 +77,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.naming]]`link
7777
[.description]
7878
--
7979
The naming convention controller.
80-
--|`none`, `lower-case`, `upper-case`, `snake-lower-case`, `snake-upper-case`
80+
--|`none`, `lower-case`, `upper-case`, `snake-lower-case`, `snake-upper-case`
8181
|`none`
8282

8383

@@ -86,38 +86,11 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.exception-sql
8686
[.description]
8787
--
8888
The SQL log type that determines the SQL log format in exceptions.
89-
--|`raw`, `formatted`, `none`
89+
--|`raw`, `formatted`, `none`
9090
|`none`
9191

9292

93-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.log.sql]]`link:#quarkus-doma_quarkus.doma.log.sql[quarkus.doma.log.sql]`
94-
95-
[.description]
96-
--
97-
Shows SQL logs.
98-
--|boolean
99-
|`false`
100-
101-
102-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.log.dao]]`link:#quarkus-doma_quarkus.doma.log.dao[quarkus.doma.log.dao]`
103-
104-
[.description]
105-
--
106-
Shows DAO logs.
107-
--|boolean
108-
|`false`
109-
110-
111-
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.log.closing-failure]]`link:#quarkus-doma_quarkus.doma.log.closing-failure[quarkus.doma.log.closing-failure]`
112-
113-
[.description]
114-
--
115-
Shows the logs of the failure to close JDBC resource.
116-
--|boolean
117-
|`false`
118-
119-
120-
h|[[quarkus-doma_quarkus.doma.named-data-sources]]link:#quarkus-doma_quarkus.doma.named-data-sources[Additional named datasources]
93+
h|[[quarkus-doma_quarkus.doma.named-data-sources-additional-named-datasources]]link:#quarkus-doma_quarkus.doma.named-data-sources-additional-named-datasources[Additional named datasources]
12194

12295
h|Type
12396
h|Default
@@ -127,7 +100,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-n
127100
[.description]
128101
--
129102
The SQL dialect.
130-
--|`db2`, `h2`, `mssql`, `mysql`, `oracle`, `postgres`, `standard`, `sqlite`
103+
--|`db2`, `h2`, `mssql`, `mysql`, `oracle`, `postgres`, `standard`, `sqlite`
131104
|`depends on 'quarkus.datasource.db-kind'`
132105

133106

@@ -136,7 +109,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-n
136109
[.description]
137110
--
138111
The batch size.
139-
--|int
112+
--|int
140113
|`0`
141114

142115

@@ -145,7 +118,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-n
145118
[.description]
146119
--
147120
The fetch size.
148-
--|int
121+
--|int
149122
|`0`
150123

151124

@@ -154,7 +127,7 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-n
154127
[.description]
155128
--
156129
The max rows.
157-
--|int
130+
--|int
158131
|`0`
159132

160133

@@ -163,17 +136,17 @@ a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-n
163136
[.description]
164137
--
165138
The query timeout limit in seconds.
166-
--|int
139+
--|int
167140
|`0`
168141

169142

170143
a|icon:lock[title=Fixed at build time] [[quarkus-doma_quarkus.doma.-datasource-name-.sql-load-script]]`link:#quarkus-doma_quarkus.doma.-datasource-name-.sql-load-script[quarkus.doma."datasource-name".sql-load-script]`
171144

172145
[.description]
173146
--
174-
Name of the file containing the SQL statements to execute when Doma starts. Its default value differs depending on the Quarkus launch mode:
175-
* In dev and test modes, it defaults to `import.sql`. Simply add an `import.sql` file in the root of your resources directory and it will be picked up without having to set this property. Pass `no-file` to force Doma to ignore the SQL import file. * In production mode, it defaults to `no-file`. It means Doma won't try to execute any SQL import file by default. Pass an explicit value to force Doma to execute the SQL import file.
176-
--|string
147+
Name of the file containing the SQL statements to execute when Doma starts. Its default value differs depending on the Quarkus launch mode:
148+
++*++ In dev and test modes, it defaults to `import.sql`. Simply add an `import.sql` file in the root of your resources directory and it will be picked up without having to set this property. Pass `no-file` to force Doma to ignore the SQL import file. ++*++ In production mode, it defaults to `no-file`. It means Doma won't try to execute any SQL import file by default. Pass an explicit value to force Doma to execute the SQL import file.
149+
--|string
177150
|`import.sql in DEV, TEST ; no-file otherwise`
178151

179-
|===
152+
|===

runtime/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
<artifactId>doma-core</artifactId>
3030
<version>${doma.version}</version>
3131
</dependency>
32+
<dependency>
33+
<groupId>org.seasar.doma</groupId>
34+
<artifactId>doma-slf4j</artifactId>
35+
<version>${doma.version}</version>
36+
</dependency>
3237
</dependencies>
3338

3439
<build>

0 commit comments

Comments
 (0)