Appending to debug.log file

Until now debug.log files were loaded into memory, concatenated and then re-written to disk. This is an intensive operation on a large file.

I've added the `FILE_APPEND` flag to append to this file instead.
Merge pull request #2518 from dhensby/patch-1

Appending to debug.log file