When following this Spring example I was expecting to see output like this:
Creating tables
Inserting customer record for John Woo
Inserting customer record for Jeff Dean
...
Instead, I got some DEBUG
log messages interspersed between every line:
Creating tables
12:31:16.474 [main] DEBUG o.s.jdbc.core.JdbcTemplate - Executing SQL statement [drop table customers if exists]
12:31:16.484 [main] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
12:31:16.484 [main] DEBUG o.s.j.d.SimpleDriverDataSource - Creating new JDBC Driver Connection to [jdbc:h2:mem]
...
These various answers seem to indicate that this can be resolved by changing the log level in my log4j.properties
file. However, in following the Spring example a log4j.properties
file is never mentioned.
Interestingly, Spring does appear to be using log4j
internally:
$ grep -R "log4j" *
Binary file build/libs/gs-relational-data-access-0.1.0.jar matches
I imagine I could use log4j
to fix this problem, but the manual doesn't seem to have information on where to put log4j.properties
or how to integrate it into this project.
How do I change the log level to remove those DEBUG
statements?
If I need to use a log4j.properties
file, where do I place it? Do I need to tie it to my build.gradle
file, or reference it in my .java
files somehow?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…