Fix handling of json input with flush single
Improve some logging
Support byte-size flushing limit and flush retry