Added check for null logmessage