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
I have added files in 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
# 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?
just I'm able to see some request logs logging view page