This project is read-only.

Debugging SqlDatabaseLog Configuration

Topics: Using
Sep 30, 2014 at 3:07 PM
Edited Sep 30, 2014 at 3:10 PM

Heh. As soon as I finished writing this, it started working... what kind of sorcery is this?

Original post

I created a custom event source class named ServiceEventSource that successfully passes validation. I found a lot of articles that discuss how to raise log events that helped me with that. Turns out that that was just the easy part. Now I'm trying to attach a listener that forwards logs to an sqlexpress database sink, and it just won't work. I can't figure out what I'm doing wrong either.

My configuration code:
var listener = SqlDatabaseLog.CreateListener(
... followed by ...
listener.EnableEvents(ServiceEventSource.Log, EventLevel.LogAlways, Keywords.All);
Connection string:
<add name="logging"
     connectionString="Server=.\SQLEXPRESS;Database=Logging;Persist Security Info=True;User ID=myRealUserId;Password=myRealPassword"
Additional info:
  • the application that raises log events is a windows service
  • no records are added when a log event is raised
  • no exceptions are thrown either
Am I missing something obvious?
Sep 30, 2014 at 7:18 PM
Hi, consider listening to events coming from the built-in SemanticLoggingEventSource, which will notify you about errors occurring in SLAB itself. Of course, send those events to a different listener that will not have the same errors, such as to a flat file or the console in case this is a console app.

Also, verify your custom event source for correctness, such as:
public void ServiceEventSourceShouldBeValid()
More info here: