[DAY9]观察heroku logs

既然我们上传成功了,那麽接着就是要观察我们的结果啦!!
第一步:打开CMD进入资料夹登入heroku :Heroku login
接着输入heroku logs -t
第二步:回到LineDeveloper在Webhook那边按下Verify,第一次可能会显示联系时间过长,再重新按一次出现Success即可,或着对你的机器人传一句话,最後回到Cmd观察结果
https://ithelp.ithome.com.tw/upload/images/20210923/20140159e2sT59hvnb.png
或着开启Heroku 点选view logs
https://ithelp.ithome.com.tw/upload/images/20210923/20140159meUjPtRfIZ.jpg
在机器人上随意输入文字
https://ithelp.ithome.com.tw/upload/images/20210923/20140159n5LLABxXWB.png
https://ithelp.ithome.com.tw/upload/images/20210923/20140159dT1MQI30Ve.png
下面为LOG小解释我们可以利用之前的print(body) 来DEBUG
2021-09-10T13:01:12.143737(时间)+00:00(时区) herokuweb.1
#开机过程

2021-09-10T13:01:12.143737+00:00 heroku[web.1]: Unidling
2021-09-10T13:01:12.191184+00:00 heroku[web.1]: State changed from down to starting
2021-09-10T13:01:15.215188+00:00 heroku[web.1]: Starting process with command `python app.py`
2021-09-10T13:01:17.890501+00:00 app[web.1]:  * Serving Flask app 'app' (lazy loading)
2021-09-10T13:01:17.890523+00:00 app[web.1]:  * Environment: production
2021-09-10T13:01:17.890524+00:00 app[web.1]:    WARNING: This is a development server. Do not use it in a production deployment.
2021-09-10T13:01:17.890542+00:00 app[web.1]:    Use a production WSGI server instead.
2021-09-10T13:01:17.890562+00:00 app[web.1]:  * Debug mode: off
2021-09-10T13:01:17.891354+00:00 app[web.1]:  * Running on all addresses.
2021-09-10T13:01:17.891355+00:00 app[web.1]:    WARNING: This is a development server. Do not use it in a production deployment.
2021-09-10T13:01:17.891443+00:00 app[web.1]:  * Running on http://172.17.235.246:3934/ (Press CTRL+C to quit)
2021-09-10T13:01:18.910050+00:00 heroku[web.1]: State changed from starting to up

#我们在程序码中打的BODY

2021-09-10T13:01:20.259516+00:00 app[web.1]: {"destination":"Ufdb60144d9df5192d6b70e710f80fc98",
#资料类型及讯息等细项
"events":[{"type":
"message","message":{"type":"text","id":"14723942825210","text":"123"},
#时间
"timestamp":1631278871264,
"source":{"type":"user","userId":"U27a3a4b39f0eb83d470fb1e80a55f18c(使用者ID之後可以用於@之类等动作)"},
"replyToken":"8732dfb931314c7da13e179245c7d5dd","mode":"active"}]}

#显示讯息格式及过程

2021-09-10T13:01:20.509499+00:00 app[web.1]: 10.1.29.43 - - [10/Sep/2021 13:01:20] "POST /callback HTTP/1.1" 200 -
2021-09-10T13:01:20.511085+00:00 heroku[router]: at=info method=POST path="/callback" host=juctest.herokuapp.com request_id=b7d7973e-3b68-4e50-acb2-4294cfe008b9 fwd="147.92.149.166" dyno=web.1 connect=0ms service=251ms status=200 bytes=154 protocol=https
2021-09-10T13:01:30.216586+00:00 app[web.1]: {"destination":"Ufdb60144d9df5192d6b70e710f80fc98","events":[{"type":"message","message":{"type":"text","id":"14723944538162","text":"ABC"},"timestamp":1631278889400,"source":{"type":"user","userId":"U27a3a4b39f0eb83d470fb1e80a55f18c"},"replyToken":"0a8b77ba7f1c4783a750b6117d438038","mode":"active"}]}
2021-09-10T13:01:30.535723+00:00 heroku[router]: at=info method=POST path="/callback" host=juctest.herokuapp.com request_id=5814d2d5-3a1a-4119-856c-3d75d6cd9f75 fwd="147.92.149.166" dyno=web.1 connect=0ms service=321ms status=200 bytes=154 protocol=https
2021-09-10T13:01:30.536112+00:00 app[web.1]: 10.1.87.69 - - [10/Sep/2021 13:01:30] "POST /callback HTTP/1.1" 200 -

参考资料:第 11 天:LINE BOT SDK:应用程序编程介面|从LINE BOT到资料视觉化:赖田捕手 系列


<<:  用React刻自己的投资Dashboard Day8 - useState hook

>>:  Day23:安全性和演算法-混成密码系统(Hybrid Cryptosystem)

Day18 - 使用ViewBinding取代Kotlin Android Extension

今天是预料之外的内容。 Kotlin在1.4.20-M2版本中弃用了Kotlin Android E...

如何让网路社团的发文得到较好的转换效果

透过网路社团发文做行销,因为几乎等於零成本,所以一直都是很热门的行销管道,但要得到好的发文转换效果,...

Day 08 Create a classification model with Azure Machine Learning designer

Classification - Predict category or class Train r...

[面试][後端]你会的後端框架不只一个,可以说明一下它们之间的差异吗?

你是十八般武艺样样精通,还是样样通样样松? 工程师真的很难,会得不多会被问为什麽没学,会得很多还要...

Material UI in React [ Day 20] Feedback

今天会对 Feedback 的部分做讲解,因为都比较简单的应用就会一起讲。 Progress 进度指...