Stable5: Try to create custom log file before falling back to default.

Backport of #5437 

@DeepDiver1975 @karlitschek