warnings.warn() vs. logging.warning()

I agree with the other answer — logging is for logging and warning is for warning — but I’d like to add more detail.

Here is a tutorial-style HOWTO taking you through the steps in using the logging module.
https://docs.python.org/3/howto/logging.html

It directly answers your question:

warnings.warn() in library code if the issue is avoidable and the
client application should be modified to eliminate the warning

logging.warning() if there is nothing the client application can do
about the situation, but the event should still be noted

Leave a Comment

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.