I am looking for best practices to implement a TraceListener that will write logs inside SQL server from an ASP.NET application.
What are the things that should be taken into account when implementing such a class in order to avoid performance reduction?
Will stored procedures be faster than plain ADO.NET INSERT statements?
I really like the idea of writing the logs into a temporary in-memory buffer and flush it to the database at some later point from a background thread, but what data structure is most suitable for such scenario? Queue<T> seems like a good candidate but I cannot add elements to it without some synchronization mechanism.
I found over the internet an article that shows an example of a custom TraceListener that writes to SQL server but before putting it into production code I would like to have some more feedback.