Generic logging for 4xx errors