deal with logfile permission errors properly (once and for all I hope). Related #1397