views:

114

answers:

2

I'm writing into a log file, but I want to log into a table named "Log" in my database.

How can I accomplish this?

+2  A: 

Check out logging.apache.org for the log4X that fits the language you are using. I know they have log4j (Java) and log4net (C#/.Net). They also have examples on how to configure the logging framework to log to a database table instead of a file.

tvanfosson
+3  A: 

log4net has an AdoNetAppender, and a sample configuration right here.

Blair Conrad
The huge advantage of using log4net too, is that you can switch between logging to your SQL server, and any other method you like (files, event log...whatever) by simply altering your config file.
Stuart Helwig