Did some tests and writing to file is too performance expensive. I profiled a quite long process and it logged 100-200 debug messages. And it took 15 seconds when I logged to a file. When disabled, it took 7 seconds to run the process. So the write to file cost me 8 seconds.