make sure logfiles are created with the correct permissions

and removed umask(), it is not tread-safe