fixed device detection string, added mkdir for the log dir