Eclipse显示奇怪[DEBUG],我想禁用它

Amm*_*mar 4 java eclipse debugging ormlite

根据下面的代码,我将程序的每个细节都作为调试,我想摆脱它.如果在运行应用程序时花费太多时间.

如何禁用[DEBUG]?

2012-01-24 18:47:25,305 [ERROR] SqliteDatabaseType WARNING: you seem to not be using the Xerial SQLite driver.  See ORMLite docs on SQLite: http://ormlite.com/docs/sqlite
2012-01-24 18:47:25,379 [DEBUG] DaoManager created dao for class class .......
2012-01-24 18:47:25,385 [DEBUG] DaoManager created dao for class class .......
2012-01-24 18:47:25,397 [DEBUG] DaoManager created dao for class class .......
2012-01-24 18:47:25,398 [DEBUG] DaoManager created dao for class class .......
2012-01-24 18:47:25,401 [DEBUG] DaoManager created dao for class class .......
2012-01-24 18:47:25,401 [DEBUG] DaoManager created dao for class class .......
2012-01-24 18:47:25,402 [DEBUG] DaoManager created dao for class class .......
2012-01-24 18:47:25,403 [DEBUG] DaoManager created dao for class class .......
2012-01-24 18:47:25,404 [DEBUG] DaoManager created dao for class class .......
2012-01-24 18:47:25,404 [DEBUG] DaoManager created dao for class class .......
2012-01-24 18:47:25,635 [DEBUG] StatementBuilder built statement SELECT.......
Run Code Online (Sandbox Code Playgroud)

Gra*_*ray 7

如果已为DEBUG或TRACE设置了日志级别,ORMLite会发出大量日志消息以进行调试.如果您正在使用log4j,那么您需要log4j.properties在您src/main/resourcessrc/test/resources文件夹中查找通常(在Eclipse中)的文件.它可能看起来像:

log4j.rootLogger=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
...
Run Code Online (Sandbox Code Playgroud)

这表示默认的日志记录级别是DEBUG.如果将其更改为INFO,则仅显示信息消息及以上信息. ERROR只会显示错误及以上.

您可以通过将以下内容添加到log4j.properties文件中来专门关闭ORMLite消息:

log4j.logger.com.j256.ormlite=INFO
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助.

  • 但是如果我没有使用log4j但是那些调试消息仍然出现呢?如果他们如何摆脱呢? (3认同)
  • 我的项目根目录中没有任何*.properties文件,我没有将log4j添加到系统路径,也没有项目构建路径.在项目根目录中创建文件`ormliteLocalLog.properties`并添加一行`com\.j256\.ormlite.*= INFO`没有帮助.有什么建议? (2认同)
  • 我不确定项目根目录是该文件的正确位置.通常我把它放在`src/main/resources`中.它应该是您的类路径的根,而不是项目.如果您使用的是Android,请访问:http://ormlite.com/docs/android-logging (2认同)