How to use logging in an extension?

A default Python logger is already configured allows you to see all kinds of errors (coming from Python, VTK, ITK, Qt, CTK, etc.) at one place, giving you a clear picture of what is happening in the application. In Slicer-5.2 and later these logs also appear in the Python console (you can adjust the Python console log level in application settings / Python). If you change the default logger configuration then you might make some Python logs not show up in the application log, which may make user support/troubleshooting a bit more difficult.

For debugging on your own computer, I would highly recommend using a Python debugger instead of relying on logging - see setup instructions here.

Overall, we rarely see a need for custom Python logging, but if you find that you need it anyway then you should be able to set it up. You can see how to make the logs show up in various places (Python console, application log, etc.) here, where the default Python logger is set up.