Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Logging

Ray Luo edited this page Apr 16, 2019 · 2 revisions

How to disable ADAL Python logging?

Historically ADAL Python (up to 1.2.1) will emit some logs at INFO level. If you happen to also configure your Python script's root logger with INFO level, you will then see many ADAL Python internal logs, which may not be what you want.

In Python, the standard way to disable logs in an underlying library, is to explicitly configure their logger to a higher level. And, since ADAL Python uses a logger named adal-python, you can easily disable it by adding this at the early part of your Python script:

import logging
logging.getLogger("adal-python").setLevel(logging.WARN)  # Disable INFO and DEBUG

Personal Identifiable Information (PII) & Organizational Identifiable Information (OII)

Starting from ADAL Python 0.5.1, by default, ADAL logging does not capture or log any PII or OII. The library allows app developers to turn this on by configuring the enable_pii flag on the AuthenticationContext. By turning on PII or OII, the app takes responsibility for safely handling highly-sensitive data and complying with any regulatory requirements.

//PII or OII logging disabled. Default Logger does not capture any PII or OII.
auth_context = AuthenticationContext(...)

//PII or OII logging enabled
auth_context = AuthenticationContext(..., enable_pii=True)