Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for debug logs in executed functions. #745

Merged
merged 4 commits into from
Sep 25, 2020

Conversation

vrdmr
Copy link
Member

@vrdmr vrdmr commented Sep 24, 2020

Description

Changing the default log level to Debug. The configuration of the log levels is set at the host.json.

FYI @stefanushinardi @anthonychu

Fixes #735


PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made and CI is passing.

Quality of Code and Contribution Guidelines

@Hazhzeng
Copy link
Contributor

Hazhzeng commented Sep 24, 2020

I remember @ankitkumarr and I once dealt with a CRI where a customer's application performance got impacted due to too many logs from azure-storage-blob.

Since we're now enabling debug in Python in the root logger, I expect to see a bit more logger.debug from azure-storage-blob. (e.g. https://github.com/Azure/azure-storage-python/blob/4e03ff8c9d6c76a38666a8ceb8937593e93fb7eb/azure-storage-common/azure/storage/common/_auth.py#L93.)

I think it would be great if you can create some test cases with a host.json that controls the log level, and see if the host actually filters our worker logs.
https://docs.microsoft.com/en-us/azure/azure-functions/functions-host-json#sample-hostjson-file

    "logging": {
        "logLevel": {
          "Function.MyFunction": "Information",
          "default": "None"
        }

Currently, the Python worker tests all use host.json from testutils.py -> HOST_JSON_TEMPLATE. When the test starts, it will copy the content to each unittest folder's root (e.g. tests/unittests/http_functions/host.json) in testsutils.py -> _setup_func_app. If not taking too much time, you can create a new test instance to modify the host.json context before starting the test host. Let me know if you have any questions.

@vrdmr
Copy link
Member Author

vrdmr commented Sep 25, 2020

I think it would be great if you can create some test cases with a host.json that controls the log level, and see if the host actually filters our worker logs.
https://docs.microsoft.com/en-us/azure/azure-functions/functions-host-json#sample-hostjson-file

Done - added a new set of tests with Information log level (default) set to confirm debug logs are not sent.

Copy link
Contributor

@Hazhzeng Hazhzeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

self.assertIn('logging info', host_out)
self.assertIn('logging warning', host_out)
self.assertIn('logging error', host_out)
self.assertNotIn('logging debug', host_out)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, this explicitly test the scenario on the host logging control side. Thanks for making the change

@vrdmr vrdmr merged commit 36ac252 into dev Sep 25, 2020
@vrdmr vrdmr deleted the vameru/python-worker-in-debug-mode branch September 25, 2020 19:44
vrdmr added a commit that referenced this pull request Oct 2, 2020
* Add PYTHON_THREADPOOL_THREAD_COUNT app setting (#744)
* Adding support for debug logs in executed functions. (#745)
* Bumping up the version to 1.1.6 (#748)
vrdmr added a commit that referenced this pull request Nov 10, 2020
@vrdmr vrdmr mentioned this pull request Nov 10, 2020
5 tasks
vrdmr added a commit that referenced this pull request Nov 10, 2020
* Reverting #745 to limit Debug logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Logging level debug does not work in local or portal logs
2 participants