On Windows, I use the etc/hosts file to block some domains, for example because they are often used to serve ads. But sometimes, a program tries to connect to a blocked domain for a legitimate reason and fails. It is often unclear what is causing the program to fail at first (e.g. it could be my AV, firewall, a network issue, some other conflicting app...) and I waste time troubleshooting before finding that the hosts file is the culprit.
Is there a way to log, or perhaps receive a Windows notification, when a program attempts to reach a domain that is listed in the hosts file? Ideally it would record the timestamp, name of the program, and the domain it tried to reach.