我尝试在服务器/tcp 上使用“TRACE_LEVEL_FILE=4”
DriverManager.getConnection("jdbc:h2:tcp://localhost/" + f.toURI() +";TRACE_LEVEL_FILE=4;", "sa", "");
并将日志级别设置为警告
java.util.logging.Logger h2database = java.util.logging.Logger.getLogger("h2database");
h2database.setLevel(Level.WARNING);
我得到的只是scan123db.trace.db中的这条消息
01-24 15:04:14 database: org.h2.message.TraceWriterAdapter
org.h2.message.DbException: Class "org.h2.message.TraceWriterAdapter" not found [90086-169]
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.message.TraceSystem.setLevelFile(TraceSystem.java:199)
at org.h2.engine.Database.open(Database.java:519)
at org.h2.engine.Database.openDatabase(Database.java:222)
at org.h2.engine.Database.<init>(Database.java:217)
at org.h2.engine.Engine.openSession(Engine.java:56)
at org.h2.engine.Engine.openSession(Engine.java:159)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)
at org.h2.engine.Engine.createSession(Engine.java:121)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:136)
at java.lang.Thread.run(Unknown Source)
Caused by: org.h2.jdbc.JdbcSQLException: Class "org.h2.message.TraceWriterAdapter" not found [90086-169]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
... 11 more
Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.h2.message.TraceWriterAdapter.<init>(TraceWriterAdapter.java:28)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.h2.message.TraceSystem.setLevelFile(TraceSystem.java:197)
... 9 more
我想知道为什么?