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

Fixes #5423

@DeepDiver1975