Writes to log channel under synchronization

the actual writing of a buffer to a channel was optimized to be done
outside of the logFile monitor in b549c380817e5be0159698f57743ae10331a6568
which worked for everything, except getting the correct log position for
appenders, at that time, appending at the same time as the position was
updated in the background by the batched writes thread.

I still believe there can be made an optimization just like it, but for
now just writing the buffer inside the monitor solves the observed race
which would lead to poisoned transaction metadata cache.