Developer

 View Only
last person joined: yesterday 

Expand all | Collapse all

Set logging level or disable logging in Pycentral SDK

This thread has been viewed 13 times
  • 1.  Set logging level or disable logging in Pycentral SDK

    EMPLOYEE
    Posted Aug 24, 2021 07:04 PM
    Aruba Central's Python SDK (pycentral) uses Python's logging module. It is often required to limit what is shown in the logs. Defining logging level or disabling logs can help with this use case. 

    To set logging level for pycentral SDK:
    # To set level for logging. This example is to show logs for level ERROR and above
    # central = get_conn_from_file(filename=central_filename, account = "internal")
    import logging
    central.logger.setLevel(logging.ERROR)​


    To disable pycentral SDK's logging function:

    # To disable the logger of the pycentral SDK, whereas "central" variable is the base class object.
    # central = get_conn_from_file(filename=central_filename, account = "internal")
    central.logger.disabled = True


    [OR] To disable all of Python's Logging function:

    # To disable general logging
    import logging
    import sys
    logging.disable(sys.maxsize)


    ------------------------------
    Karthikeyan Dhandapani
    ------------------------------


  • 2.  RE: Set logging level or disable logging in Pycentral SDK

    MVP GURU
    Posted Aug 25, 2021 06:22 AM
    Thanks !

    May be add a note on pycentral README too (on github ?)

    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCL: Powershell Module to use Aruba Central

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------