use profile directory to write debug.log if possible