The problem is probably that you are trying to create an event source in a log that doesn’t exist. You need to specify the “Application” log.
Try changing it to:
if (!EventLog.SourceExists(cs))
EventLog.CreateEventSource(cs, "Application");
EventLog.WriteEntry(cs, message, EventLogEntryType.Error);
Also: Inside of sharepoint, if the app is running as logged in user(via windows auth or delegation), the user won’t have access to create the event source. If this is the case, one trick is to create the event using a ThreadPool thread, which when created, will have the security context of the user the App Pool is running as.