0

我正在开发一个 Appengine Connected Android 项目。我需要在每个端点方法等的服务器端添加一些日志记录。有没有一种简单的方法可以做到这一点?

我有一个包含我所有端点方法的类。那么如果我要使用java.util.logging.Logger我应该创建一个静态变量吗?

private final static Logger LOG = Logger.getLogger(MyEndpoint.class.getName());

public MyEndpoint() {
    LOG.setLevel(Level.INFO);
}
    ....

如果我这样做会影响我的服务器的瓶颈吗?基本上,有人请给我一个简单的例子,它可以在不影响我的服务器并发的情况下工作。

我的服务器使用 GEP 和 DataNuclear 以及一些本机 GQL。

4

1 回答 1

0

The LOG valiable declaration looks good to me. You just simply call LOG.info("<Your message>") and messages will show up in the Logs section of the admin console. Using a logger is a good practice and I wouldn't worry to much of being the "bottleneck" or affecting concurrency.

See:

https://developers.google.com/appengine/articles/logging

Logging Google App Engine application

于 2014-04-18T14:05:19.057 回答