Fix data race in TestLogEvent

Found with -race. Improve locking on Server.