added autoswitching for log