logfp must flush
sqlite db saved in var dir