[英]Where can I see App logs which I have written in java app in google cloud platform?
import java.util.logging.Logger;
@WebServlet(name = "HelloAppEngine", value = "/hello")
public class HelloAppEngine extends HttpServlet {
private static final Logger log = Logger.getLogger(HelloAppEngine.class.getName());
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException {
log.info("This information log message for doGet");
Properties properties = System.getProperties();
response.setContentType("text/plain");
response.getWriter().println("Hello App Engine - Standard using "
+ SystemProperty.version.get() + " Java "
+ properties.get("java.specification.version"));
}
public static String getInfo() {
log.info("This information log message for getInfo.");
return "Version: " + System.getProperty("java.version")
+ " OS: " + System.getProperty("os.name")
+ " User: " + System.getProperty("user.name");
}
In this java sample code, I have written log messages在这个 java 示例代码中,我写了日志消息
I have added files in webapp/WEB-INF/appengine-web.xml我在 webapp/WEB-INF/appengine-web.xml 中添加了文件
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<runtime>java8</runtime>
<threadsafe>true</threadsafe>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
and file webapp/WEB-INF/logging.properties和文件 webapp/WEB-INF/logging.properties
# Set the default logging level for all loggers to WARNING
.level = WARNING
after project deploy the project is running well app view项目部署后项目运行良好应用程序视图
But I can't able to see the app logs in https://console.cloud.google.com/projectselector2/logs/viewer?但我无法在https://console.cloud.google.com/projectselector2/logs/viewer 中看到应用程序日志?
just I'm able to see some request logs logging view page只是我能够看到一些请求日志记录视图页面
You have set your log level to WARNING
.您已将日志级别设置为
WARNING
。 Only warning, error and fatal (or critical) level will be displayed.只会显示警告、错误和致命(或严重)级别。 Others are skipped.
其他被跳过。
Change the level to INFO, DEBUG or TRACE in the webapp/WEB-INF/logging.properties
file, if you want to see your logs in如果您想查看您的登录信息,请在
webapp/WEB-INF/logging.properties
文件中将级别更改为 INFO、DEBUG 或 TRACE
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.