How do I write to the console in Google App Engine?

前端 未结 11 1646
终归单人心
终归单人心 2020-12-08 09:30

Often when I am coding I just like to print little things (mostly the current value of variables) out to console. I don\'t see anything like this for Google App Engine, alth

11条回答
  •  轮回少年
    2020-12-08 09:45

    @Manjoor

    You can do the same thing in java.

    import java.util.logging.Logger;
    // ...
    
    public class MyServlet extends HttpServlet {
        private static final Logger log = Logger.getLogger(MyServlet.class.getName());
    
        public void doGet(HttpServletRequest req, HttpServletResponse resp)
                throws IOException {
    
            log.info("An informational message.");
    
            log.warning("A warning message.");
    
            log.severe("An error message.");
        }
    }
    

    See "Logging" in http://code.google.com/appengine/docs/java/runtime.html

提交回复
热议问题