4

logging.properties我的Java AppEngine 项目(使用)中有一个文件,java.util.logging如下所示:

# Set the default logging level for all loggers to WARNING
.level = INFO

# tighten logging on the DataNucleus Categories
DataNucleus.JDO.level=WARN 
# - All messages general to JDO
DataNucleus.JPA.level=WARN 
#  - All messages general to JPA
DataNucleus.Persistence.level=WARN 
#  - All messages relating to the persistence process
DataNucleus.Query.level=WARN 
#  - All messages relating to queries
DataNucleus.Lifecycle.level=WARN 
#  - All messages relating to object lifecycle changes
DataNucleus.Cache.level=WARN 
#  - All messages relating to the DataNucleus Cache
DataNucleus.ClassLoading.level=WARN 
#  - All exceptions relating to class loading issues
DataNucleus.MetaData.level=WARN 
#  - All messages relating to MetaData
DataNucleus.Management.level=WARN 
#  - All messages relating to Management
DataNucleus.General.level=WARN 
#  - All general operational messages
DataNucleus.Connection.level=WARN 
#  - All messages relating to Connections.
DataNucleus.JCA.level=WARN 
#  - All messages relating to Connector JCA.
DataNucleus.Transaction.level=WARN 
#  - All messages relating to transactions
DataNucleus.Plugin.level=WARN 
#  - All messages relating to DataNucleus plug-ins
DataNucleus.ValueGeneration.level=WARN 
#  - All messages relating to value generation
DataNucleus.Datastore.level=WARN 
#  - All general datastore messages
DataNucleus.Datastore.Schema.level=WARN 
#  - All schema related datastore log messages
DataNucleus.Datastore.Persist.level=WARN 
#  - All datastore persistence messages
DataNucleus.Datastore.Retrieve.level=WARN 
#  - All datastore retrieval messages
DataNucleus.Datastore.Native.level=WARN 
#  - Log of all 'native' statements sent to the datastore
DataNucleus.Enhancer.level=WARN 
#  - All messages from the DataNucleus Enhancer.
DataNucleus.SchemaTool.level=WARN 
#  - All messages from DataNucleus SchemaTool
DataNucleus.IDE.level=WARN 
#  - Messages from the DataNucleus IDE.

可悲的是,现在我收到了日志消息,例如:

2012-04-17 16:13:45.112
org.datanucleus.plugin.NonManagedPluginRegistry resolveConstraints: Bundle "org.datanucleus.jpa" has an optional dependency to "org.datanucleus.enhancer" but it cannot be resolved

I 2012-04-17 16:13:45.115    
org.datanucleus.plugin.NonManagedPluginRegistry resolveConstraints: Bundle "org.datanucleus" has an optional dependency to "org.eclipse.equinox.registry" but it cannot be resolved

I 2012-04-17 16:13:45.719
org.datanucleus.PersistenceConfiguration setProperty: Property datanucleus.rdbms.sql.allowAllSQLStatements unknown - will be ignored

I 2012-04-17 16:13:47.806
org.datanucleus.store.appengine.MetaDataValidator validate: Performing appengine-specific metadata validation for in.animeshpathak.nazdeeq.models.Note

有人可以告诉我如何正确配置我的logging.properties文件吗?我现在需要通用日志级别才能INFO从我的代码中查看调试消息,但想将所有 DataNucleus 日志级别设置为WARN.

谢谢。

4

1 回答 1

6

实际上,如果您想从代码中查看调试消息,您需要FINESTlevel,而不是INFO.

尝试将您的 logging.properties 替换为:

# Set the default logging level for all loggers to FINEST
.level=FINEST

# Set the default logging level for ORM, specifically, to WARNING
DataNucleus.JDO.level=WARNING
DataNucleus.Persistence.level=WARNING
DataNucleus.Cache.level=WARNING
DataNucleus.MetaData.level=WARNING
DataNucleus.General.level=WARNING
DataNucleus.Utility.level=WARNING
DataNucleus.Transaction.level=WARNING
DataNucleus.Datastore.level=WARNING
DataNucleus.ClassLoading.level=WARNING
DataNucleus.Plugin.level=WARNING
DataNucleus.ValueGeneration.level=WARNING
DataNucleus.Enhancer.level=WARNING
DataNucleus.SchemaTool.level=WARNING

根据DataNucleus的建议,这要简洁得多:

# Set the default logging level for all loggers to FINEST
.level=FINEST

# Set the default logging level for ORM, specifically, to WARNING
DataNucleus.level=WARNING
于 2012-04-17T17:13:45.700 回答