[英]Making log messages visible on Java GoogleAppEngine development server (used with GWT)
I am using java.util.logging.Logger
to do my logging on my Java GoogleAppEngine app. 我正在使用java.util.logging.Logger
来登录我的Java GoogleAppEngine应用程序。 This works peachily when the app is deployed. 部署应用程序时,这很有效。 However, I am unable to see my log messages when running my app in the development server. 但是,在开发服务器中运行我的应用程序时,我无法看到我的日志消息。
Salient additional details: 突出的附加细节:
Has anyone gotten logging working in development mode (with or without using AppEngine in conjunction with the GWT development mode container)? 是否有人在开发模式下进行日志记录(有或没有将AppEngine与GWT开发模式容器一起使用)? Is there some magic incantation I need to see my logging output? 我需要看一些神奇的咒语来查看我的日志输出吗?
I had the same problem yesterday, but now it works for me. 我昨天遇到了同样的问题,但现在它对我有用。
Not sure what the change was, but I will post my configuration below so you can try it out (running GAE 1.3.8, no GWT but shouldnt matter). 不知道改变是什么,但我会在下面发布我的配置,你可以尝试一下(运行GAE 1.3.8,没有GWT但不重要)。
Please note that the logs will appear in the console window (amongst the other server logging). 请注意,日志将显示在控制台窗口中(在其他服务器日志记录中)。 I am not sure you can get it to log to files since the server is running in some kind of sandbox. 由于服务器在某种沙箱中运行,我不确定您是否可以将其记录到文件中。 I have only tested this configuration in my local environment, not uploaded. 我只在本地环境中测试了此配置,而不是上传。
WEB-INF/appengine-web.xml: WEB-INF / AppEngine上-web.xml中:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<!-- (omitted application,version from sample-->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
WEB-INF/logging.properties: WEB-INF / logging.properties:
# Set the default logging level for all loggers to WARNING
#.level = WARNING
#.level = ALL
.level = INFO
logtest.jsp: logtest.jsp:
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import=" java.util.logging.Logger"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="sv" xml:lang="sv">
<head>
</head>
<%
Logger logger = Logger.getLogger("org.whatever.Logtest");
logger.info("logtest info");
logger.warning("logtest warning");
logger.severe("logtest severe");
%>
<body>
Check the console for logging
</body>
</html>
Plase change your WEB-INF/logging.properties file. Plase更改您的WEB-INF / logging.properties文件。
Add 加
.level=INFO
Make sure you have the right log classes and logging level set up in your logging.properties
file: 确保在logging.properties
文件中设置了正确的日志类和日志记录级别:
WEB-INF/logging.properties: WEB-INF / logging.properties:
# Configure a file log for devserver
handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler
java.util.logging.FileHandler.pattern=/tmp/appengine-devserver.log
java.util.logging.FileHandler.limit=0 # no limit
java.util.logging.FileHandler.count=1
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
# Set the default logging level for all loggers to WARNING
.level = INFO
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.