added ability to set log level
log handling fixes