Adds logger flushing when changing trace mode