Python logging: __name__

I’ve been using the recommended idiom of getLogger(__name__) to log stuff in Python code. That’s supposed to turn into your module name so you get nice names like “openaddr.conform” for the file openaddr/conform.py.

Only it totally breaks if you invoke conform.py as a main function via python -m or the like. Because of course __name__ is set to __main__ in that condition.

Wonder why none of the logging tutorials mention that gotcha?