improved flock usage in log(), to hopefully solve server stall issue