如何调试cron作业以及如何查看日志?

时间:2016-07-25 08:51:36

标签: java google-app-engine servlets logging cron

我在app-engine上有一个带有servlet的web应用程序

和调用该servlet的cron作业

我看到cron返回状态200,但我没有看到DB中的预期更改

private static final Logger logger = Logger.getLogger(MatchingServlet.class.getName());


@Override
public void init(ServletConfig config) {
    String credential = config.getInitParameter("credential");
    String databaseUrl = config.getInitParameter("databaseUrl");

    System.out.println("Credential file : " + credential);
    logger.info("Credential file : " + credential);

我曾尝试添加日志记录,但我如何才能在google-cloud控制台中看到它们

enter image description here

cron.xml

<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
    <cron>
        <url>/match</url>
        <description>find buddies to all users</description>
        <schedule>every 2 minutes</schedule>
    </cron>
</cronentries>

my methods:


@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    logger.info("in matching-servlet doGet");
    doPost(req, resp);
}

@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    logger.info("in matching-servlet doPost");
    firebase.child("users").addListenerForSingleValueEvent(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {

0 个答案:

没有答案