Logging#

Connected-service logging uses the shared ansys.dynamicreporting.core logger. PyDynamicReporting does not change the application’s root logger.

Write logs to standard output#

Pass log_output="stdout" when constructing a Service:

import logging

import ansys.dynamicreporting.core as adr

service = adr.Service(
    ansys_installation=r"C:\Program Files\ANSYS Inc\v261",
    log_output="stdout",
    log_level=logging.INFO,
)

Write logs to a file#

Any other log_output value is treated as a file path:

service = adr.Service(
    ansys_installation=r"C:\Program Files\ANSYS Inc\v261",
    log_output=r"C:\reports\pydynamicreporting.log",
    log_level="DEBUG",
)

If log_level is omitted, the existing level on the shared ADR logger is left unchanged. If log_output is omitted, PyDynamicReporting adds no visible output handler.

Repeated calls with the same standard-output stream or normalized file path do not add duplicate PyDynamicReporting-owned handlers. This prevents duplicate lines when multiple Service objects reuse the package logger.

Configure the package logger directly#

Use get_logger() when you need to configure logging before constructing a service:

from ansys.dynamicreporting.core.adr_utils import get_logger

logger = get_logger(log_output="stdout", log_level="WARNING")

The positional logfile argument remains available for compatibility but is deprecated. It emits DeprecationWarning. Passing both logfile and log_output raises ValueError.