如何在azure webapp中像控制台一样在屏幕上查看日志?

我已经在 azure webapp 上部署了 python 代码。


def main():

    logging.basicConfig(filename="logtesting",

                            filemode='a',

                            format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',

                            datefmt='%H:%M:%S',

                            level=logging.DEBUG)

    logging.info("Main thread started...")

    print("Main thread started...")

我尝试查看日志log stream,但看不到任何类似于我们在控制台上看到的内容。

https://img1.sycdn.imooc.com/6582d4010001d14606500324.jpg

有什么设置吗?因为we do not have any option of App insight when we use python in azure webapp



POPMUISE
浏览 59回答 1
1回答

HUX布斯

-更改代码以登录到控制台。- 在应用程序服务中,单击应用程序服务日志菜单并启用应用程序日志记录。- 您可以通过单击“日志流”菜单或在终端中使用以下命令查看门户中的日志流:az&nbsp;webapp&nbsp;log&nbsp;tail&nbsp;--name&nbsp;<app-name>&nbsp;--resource-group&nbsp;<resourceGroup>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python