Reputation: 17271
I'm writing an .NET 3.5 web application that is using LinqToSql for the basic database stuff. I'd like to use the nLog library for logging. This library can log to a database using good ol' fashioned stored procedures (not that there is anything wrong with that..) but I'd like to use the LingToSql DataContext to log to the database
Does anyone know how to do this? I am aware version 2.0 of nLog is coming, but it's not here yet...
-Edoode
Upvotes: 0
Views: 578
Reputation: 1524
I think what @edosoft was looking for is something like this:
A simple TextWriter you can assign to DataContext.Log property instead of Console.Out to register LinqToSql logging using NLog.
Upvotes: 1
Reputation: 29342
If you wish to use LINQ to do it, then create your own target to write to. I don't see why if you have SProcs though, the fastest possible way to write messages using C# to a database (bar a bulk load) is via the native SQL api and calling a stored proc. Plus if someone has already written a DB target for you...
Upvotes: 2