gpt4 book ai didi

java - 伯克利数据库 GAE

转载 作者:行者123 更新时间:2023-12-01 11:57:02 25 4
gpt4 key购买 nike

我正在尝试在 GAE 上使用 Berkely DB,除了日志记录之外,一切正常。这是代码片段

EnvironmentConfig envConfig = new EnvironmentConfig();
envConfig.setAllowCreate(allowCreateNew);
envConfig.setConfigParam(EnvironmentConfig.FILE_LOGGING_LEVEL, "OFF");
envConfig.setConfigParam(EnvironmentConfig.CONSOLE_LOGGING_LEVEL, "OFF");
envConfig.setLoggingHandler(null);
envConfig.setReadOnly(isReadOnly);
envConfig.setTransactional(false);
if (cacheSize != null)
envConfig.setCacheSize(cacheSize);
env = new Environment(dbPath, envConfig);

可以看出,我已禁用日志记录,并且 GAE 上的logging.properties 文件为

.level = WARNING
handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=OFF
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

# 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
java.sql.level=WARNING

我遵循了 stackoverflow 上其他人给出的所有指示,但我仍然得到

java.lang.NoClassDefFoundError: java.util.logging.ConsoleHandler is a restricted class. Please see the Google  App Engine developer's guide for more details.
at

com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
at com.sleepycat.je.utilint.ConsoleRedirectHandler.<init>(ConsoleRedirectHandler.java:26)
at com.sleepycat.je.utilint.LoggerUtils.getLogger(LoggerUtils.java:198)
at com.sleepycat.je.dbi.StartupTracker.<init>(StartupTracker.java:151)
at com.sleepycat.je.dbi.EnvironmentImpl.<init>(EnvironmentImpl.java:437)
at com.sleepycat.je.dbi.EnvironmentImpl.<init>(EnvironmentImpl.java:410)
at com.sleepycat.je.dbi.DbEnvPool.getEnvironment(DbEnvPool.java:178)
at com.sleepycat.je.Environment.makeEnvironmentImpl(Environment.java:251)
at com.sleepycat.je.Environment.<init>(Environment.java:232)
at com.sleepycat.je.Environment.<init>(Environment.java:176)

任何有关如何禁用 Berkley DB 日志记录的指示将不胜感激!

最佳答案

看起来像com.sleepycat.je.utilint.LoggerUtils .getLogger 方法始终尝试在根记录器上安装处理程序(如果它们不存在)。具体来说,它正在尝试安装:

  1. java.util.logging.ConsoleHandler
  2. com.sleepycat.je.utilint.ConsoleRedirectHandler
  3. com.sleepycat.je.utilint.FileRedirectHandler
  4. com.sleepycat.je.utilint.ConfiguredRedirectHandler

更改日志记录配置不会阻止代码尝试执行此操作。

看来确实应该修补 com.sleepycat.je.utilint.LoggerUtils 以处理 addHandlers 抛出的 SecurityException和 NoClassDefFoundError 对于扩展受限类的类。

关于java - 伯克利数据库 GAE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28372471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com