简体   繁体   English

使用Java登录Google App Engine开发服务器

[英]logs in Google App Engine Developement server using Java

I am using Google App Engine with Java. 我正在使用带有Java的Google App Engine。 I just want to view the logs in the console or a file. 我只想在控制台或文件中查看日志。

I did the code like this. 我做了这样的代码。

    Logger log = Logger.getLogger(Constants.class.getName());
    log.log(Level.WARNING, "Test Log");

But is not displaying anywhere. 但是没有显示任何地方。 I checked the local admin console for AppEngine, but it is not there also. 我在本地管理控制台中检查了AppEngine,但它也不在那里。 Other posts says it will be displayed, but it is not displaying or not giving any errors. 其他帖子说它将显示,但未显示或未出现任何错误。 My Application works fine. 我的申请工作正常。

PS: This question have been asked a lot of places in internet, but none of them resolved my issue. PS:这个问题在互联网上已经问了很多地方,但是没有一个人解决了我的问题。 That's why I am asking it again 这就是为什么我再问一次

In your appengine.web.xml, have you defined logging properties ? 在您的appengine.web.xml中,您是否定义了日志记录属性?

<system-properties>
     <property name="java.util.logging.config.file" value="web-inf/logging.properties"/>
  </system-properties>

Secondly, appengine has different versions. 其次,appengine具有不同的版本。 Are you deploying on the same version for which you are looking for logs ? 您是否正在为要查找日志的相同版本进行部署?

I tried with below format and able to see warning message at local. 我尝试使用以下格式,并且能够在本地看到警告消息。

import java.util.logging.Logger; 导入java.util.logging.Logger;
public class ContactsAPI 公共类ContactsAPI
{ {
private static final Logger log = Logger.getLogger(ContactsAPI.class.getName()); 私有静态最终Logger日志= Logger.getLogger(ContactsAPI.class.getName());

public Contact createContact(Contact contact) 公共联系人createContact(联系人)
{ {
log.warning("Input received data = " + contact); log.warning(“输入接收到的数据=” +联系人);
} }
} }

Console log : 控制台日志:

Jan 06, 2016 4:15:57 PM com.ContactsAPI createContact WARNING: Input received data = id: null [SYSTEM last_name ss] ] 2016年1月6日,下午4:15:57 com.ContactsAPI createContact警告:输入接收到的数据= id:null [SYSTEM last_name ss]]

Please check logging.properties should exist at "web-inf/logging.properties". 请检查logging.properties应该存在于“ web-inf / logging.properties”中。 I am attaching the logging properties file screen shot : http://snag.gy/HsB5q.jpg 我将附加日志记录属性文件的屏幕快照: http : //snag.gy/HsB5q.jpg

Try to debug the code at log.warning(""); 尝试在log.warning(“”);中调试代码。 can help you if new line is coming in console or not. 如果控制台中没有新行,可以为您提供帮助。

当我将32位eclipse与32位JDK一起使用时,一切开始正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM