Google 未找到云日志处理程序
Google Cloud Logging Handler Not Found
我的 google App Engine 本地开发服务器 returns 当我将记录器指向 google 云日志处理程序时出现 classdef 未找到异常,我该如何修复这个?
INFO: Dev App Server is now running
Can't load log handler "com.google.cloud.logging.LoggingHandler"
java.lang.ClassNotFoundException: com.google.cloud.logging.LoggingHandler
java.lang.ClassNotFoundException: com.google.cloud.logging.LoggingHandler
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.logging.LogManager.run(LogManager.java:965)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
at java.util.logging.LogManager.addLogger(LogManager.java:1165)
at java.util.logging.LogManager.demandLogger(LogManager.java:556)
at java.util.logging.Logger.demandLogger(Logger.java:455)
at java.util.logging.Logger.getLogger(Logger.java:502)
at coffee.weneed.chat.CoffeeChat.<clinit>(CoffeeChat.java:37)
at coffee.weneed.chat.kik.KikServlet.doGet(KikServlet.java:18)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at ...
我的logging.properties:
.level = INFO
io.grpc.netty.level=INFO
sun.net.level=INFO
coffee.weneed.chat.CoffeeChat.handlers=com.google.cloud.logging.LoggingHandler,java.util.logging.ConsoleHandler
com.google.cloud.logging.LoggingHandler.log=coffee_chat
com.google.cloud.logging.LoggingHandler.level=INFO
com.google.cloud.logging.LoggingHandler.flushLevel=SEVERE
com.google.cloud.logging.LoggingHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format=%3$s: %5$s%6$s
和我的系统属性:
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
我已经将云登录到maven deps,安装了cloud maven插件。我只是不太明白为什么它不会加载 class.
You have to use code to install a custom handler in GAE. This is described as a feature request for GAE. It is also a known issue with the JDK as JDK-6878454: LogManager class loading inconsistent with Java EE best practices.
问题是 LogManager 使用系统 class 加载程序来定位处理程序,但您的代码位于 Web 应用程序 class 加载程序中,它将成为子 class 加载程序。子 class 加载器可以在父级中定位 classes,但反之则不行。这就是你 java.lang.ClassNotFoundException
.
的原因
你可以关注this example setting up a custom handler setup in GAE。这使用 ServletContextListener
来访问正确的 class 加载器。
我的 google App Engine 本地开发服务器 returns 当我将记录器指向 google 云日志处理程序时出现 classdef 未找到异常,我该如何修复这个?
INFO: Dev App Server is now running
Can't load log handler "com.google.cloud.logging.LoggingHandler"
java.lang.ClassNotFoundException: com.google.cloud.logging.LoggingHandler
java.lang.ClassNotFoundException: com.google.cloud.logging.LoggingHandler
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.logging.LogManager.run(LogManager.java:965)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:958)
at java.util.logging.LogManager.addLogger(LogManager.java:1165)
at java.util.logging.LogManager.demandLogger(LogManager.java:556)
at java.util.logging.Logger.demandLogger(Logger.java:455)
at java.util.logging.Logger.getLogger(Logger.java:502)
at coffee.weneed.chat.CoffeeChat.<clinit>(CoffeeChat.java:37)
at coffee.weneed.chat.kik.KikServlet.doGet(KikServlet.java:18)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at ...
我的logging.properties:
.level = INFO
io.grpc.netty.level=INFO
sun.net.level=INFO
coffee.weneed.chat.CoffeeChat.handlers=com.google.cloud.logging.LoggingHandler,java.util.logging.ConsoleHandler
com.google.cloud.logging.LoggingHandler.log=coffee_chat
com.google.cloud.logging.LoggingHandler.level=INFO
com.google.cloud.logging.LoggingHandler.flushLevel=SEVERE
com.google.cloud.logging.LoggingHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format=%3$s: %5$s%6$s
和我的系统属性:
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
我已经将云登录到maven deps,安装了cloud maven插件。我只是不太明白为什么它不会加载 class.
You have to use code to install a custom handler in GAE. This is described as a feature request for GAE. It is also a known issue with the JDK as JDK-6878454: LogManager class loading inconsistent with Java EE best practices.
问题是 LogManager 使用系统 class 加载程序来定位处理程序,但您的代码位于 Web 应用程序 class 加载程序中,它将成为子 class 加载程序。子 class 加载器可以在父级中定位 classes,但反之则不行。这就是你 java.lang.ClassNotFoundException
.
你可以关注this example setting up a custom handler setup in GAE。这使用 ServletContextListener
来访问正确的 class 加载器。