Add debug logging during rewriteResources