Neo
Neo

Reputation: 16239

How to see logs on screen like console in azure webapp?

I have deployed python code on azure webapp.

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...")

I tried to see logs on log stream but unable to see anything like what we can see on console.

enter image description here

Is there any setting ? because we do not have any option of App insight when we use python in azure webapp

Upvotes: 1

Views: 1490

Answers (1)

user793891
user793891

Reputation:

-Change you code to log to the console.

-In App Service, click on the App Service Logs menu and enable Application Logging.

-You can see the logs streaming in the Portal by clicking on the Log Stream menu or in a terminal using:

az webapp log tail --name <app-name> --resource-group <resourceGroup>

Upvotes: 1

Related Questions