Verbose logs make a difficult bug easier to investigate, then quietly become another database of recipient addresses, message bodies and secrets. Choose the useful fields before leaving debug mode enabled.
Start with operational evidence
Keep timestamps, internal job identifiers, processing stages and redacted diagnostic codes. Link them to the restricted source records when an authorized investigation needs more detail. Avoid copying credentials or full messages into a broadly readable log.
Where an address is needed for support, use an access-controlled view rather than assuming every background process log should contain it. Be clear about which identifiers can still be linked back to a person.
Give debugging an end
Set a limited duration for extra logging and define who reviews and removes it. Keep the storage location private, rotate files and apply the appropriate retention policy. A log inside a public web directory needs protection independent of its unusual filename.
Test a known failure with fictional credentials and inspect the resulting output. Check exception messages too; a careful normal log format can still be bypassed by an unfiltered error.
Useful diagnostics explain what happened. They do not need to reproduce every sensitive input that passed through the system.