1
votes

Is it possible to add verbose logging to System.Data.SQLite ? I want to log all db operations such as connection opened/closed and all sql commands

1

1 Answers

2
votes

Yes, you can hook into the static Changed event on SQLiteConnection:

SQLiteConnection.Changed += (sender, eventArgs) =>
{
    Console.WriteLine($"{eventArgs.EventType}: {eventArgs.Text}");
};

This will print out lots of information. There are other properties on that eventArgs object as well.