In PyAEDT, how can I change all logger levels and prevent duplicate log messages in the console?

caleb
caleb Member Posts: 1 **

Here are what the logs currently look like in the console when I use the "Run PyAEDT Script" button in AEDT:

As you can see, I'm getting a bunch of log messages that aren't relevant to the users of my script, and each message from AEDT is getting logged twice: once with the PyAEDT INFO: format, and once with the [timestamp] - INFO - format.

I tried this:

from ansys.aedt.core.aedt_logger import pyaedt_logger
pyaedt_logger.level = logging.DEBUG

...but it had no effect.

Answers

  • James Derrick
    James Derrick Administrator, Employee Posts: 323
    Ancient Membership 100 Comments 100 Likes 25 Answers
    admin

    Hi @caleb this likely due to logging streams. I think PyAEDT is logging to two streams and both are currently routed to appear in your console, but if you follow the logging instructions in the Python docs https://docs.python.org/3/howto/logging.html you should be able to change the outputs of both of these. Potentially even to separate files. If you're still having trouble do let me know and we can go from there.