Only use log directory if it is in fact a directory

I'm not sure how to test directory permissions portably, so I'm leaving it here for comment for now.