Commit 91cf55a
authored
Support for SLF4J and Java Util Logging (#355)
- The driver now supports both SLF4J and Java Util Logging (JUL).
- The customer application can select the logging implementation by setting the system property `com.databricks.jdbc.loggerImpl`. For example: `java -jar application.jar -Dcom.databricks.jdbc.loggerImpl=JDKLOGGER`
- If the property is set to `SLF4JLOGGER` (case-insensitive), the driver will use SLF4J for logging.
- Note: The driver does not include SLF4J, SLF4J binding, or configuration files as dependencies. Therefore, if the customer application chooses SLF4J, it must provide the appropriate SLF4J, SLF4J binding, and configuration files in the classpath.
- If the property is set to `JDKLOGGER` (case-insensitive), the driver will use Java Util Logging (JUL).
- By default, driver will choose Java Util Logging (JUL).
- If the customer application has set the system property `java.util.logging.config.file` pointing to a JUL configuration file in the classpath, the driver’s JUL logger will inherit this configuration.
- If the system property `java.util.logging.config.file` is not set, the driver’s JUL logger can be configured using JDBC URL parameters: `logPath` (case-insensitive), `logLevel` (case-insensitive), `logFileCount` (case-insensitive), and `logFileSize` (case-insensitive). By default, `logLevel` is set to `Level.OFF` and `logPath` is set to the present working directory.
- The driver’s JUL will create log files with the pattern `databricks_jdbc.log.<file_index>` under the specified `logPath`.
- Developers are discouraged from using the central logging utility class `com.databricks.jdbc.commons.util.LoggingUtil`, which will be deprecated. Instead, each class should instantiate a static logger instance using `JdbcLoggerFactory#getLogger(Class<?>)`.
- Both logging implementations share a common interface `com.databricks.jdbc.log.JdbcLogger`.
- The SLF4J dependency is marked as provided. The scope of SLF4J binding (log4j) is reduced to tests.
- The `log4j2.xml` configuration file is removed from `src/main/resources`. A `logging.properties` configuration file is added in `src/test/resources` for local development and testing.1 parent 3f6b842 commit 91cf55a
File tree
18 files changed
+960
-190
lines changed- src
- main
- java/com/databricks
- client/jdbc
- jdbc
- commons/util
- driver
- log
- resources
- test
- java/com/databricks/jdbc
- driver
- local
- log
- resources
18 files changed
+960
-190
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| 111 | + | |
110 | 112 | | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| 117 | + | |
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
119 | 122 | | |
| 123 | + | |
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
| |||
247 | 251 | | |
248 | 252 | | |
249 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
250 | 258 | | |
251 | 259 | | |
252 | 260 | | |
| |||
402 | 410 | | |
403 | 411 | | |
404 | 412 | | |
405 | | - | |
406 | | - | |
| 413 | + | |
| 414 | + | |
407 | 415 | | |
408 | 416 | | |
409 | | - | |
410 | | - | |
| 417 | + | |
| 418 | + | |
411 | 419 | | |
412 | 420 | | |
413 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
| |||
Lines changed: 56 additions & 115 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
24 | 17 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 18 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 19 | + | |
50 | 20 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
57 | 26 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | 27 | | |
121 | 28 | | |
122 | 29 | | |
123 | | - | |
| 30 | + | |
124 | 31 | | |
125 | 32 | | |
126 | 33 | | |
127 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
128 | 54 | | |
129 | 55 | | |
130 | | - | |
131 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
132 | 73 | | |
133 | 74 | | |
Lines changed: 24 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 106 | | |
111 | 107 | | |
112 | 108 | | |
| |||
293 | 289 | | |
294 | 290 | | |
295 | 291 | | |
296 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
297 | 295 | | |
298 | 296 | | |
299 | 297 | | |
| |||
306 | 304 | | |
307 | 305 | | |
308 | 306 | | |
309 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
318 | 328 | | |
319 | 329 | | |
320 | 330 | | |
| |||
508 | 518 | | |
509 | 519 | | |
510 | 520 | | |
511 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
512 | 524 | | |
513 | 525 | | |
514 | 526 | | |
| |||
548 | 560 | | |
549 | 561 | | |
550 | 562 | | |
551 | | - | |
| 563 | + | |
552 | 564 | | |
553 | 565 | | |
554 | 566 | | |
| |||
Lines changed: 1 addition & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
42 | 39 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | 40 | | |
50 | 41 | | |
51 | 42 | | |
| |||
0 commit comments