properly specify log dir
use calloc instead of malloc, initializes memory with 0