In my 'Getting Started with log4net' post, I described how I was able to quickly and easily get log4net working using the FileAppender and the ConsoleAppender.

I'm actually using the AdoNetAppender in some applications I'm currently working on (I'm actually using the RollingFileAppender, ConsoleAppender and the AdoNetAppender, but more on that later).

The sample for using the AdoNetAppender given in the log4net docs  was close, but not exactly what I wanted.  I don't care about the 'thread', but I do care about the source of the log (the computer from which the log originated) and the name of the user running the application.  I'm using SQL Server as the back-end database, but log4net does support Oracle and Access.

Here is the original SQL script given in the log4net docs:
CREATE TABLE [dbo].[Log] (
    [Id] [int] IDENTITY (1, 1) NOT NULL,
    [Date] [datetime] NOT NULL,
    [Thread] [varchar] (255) NOT NULL,
    [Level] [varchar] (50) NOT NULL,
    [Logger] [varchar] (255) NOT NULL,
    [Message] [varchar] (4000) NOT NULL,
    [Exception] [varchar] (2000) NULL
)

My version of the table looks like this:
CREATE TABLE [dbo].[Log] (
    [Id] [bigint] IDENTITY (1, 1) NOT NULL,
    [Date] [datetime] NOT NULL,
    [Severity] [varchar] (50) NOT NULL,
    [Application] [varchar] (255) NOT NULL,
    [Message] [varchar] (4000) NOT NULL,
    [Source] [varchar] (50) NOT NULL,
    [CurrentUser] [varchar] (50) NULL
)

My app.config file now looks like this.  The best part is that my code doesn't need to change.  I can keep adding Appenders without ever needing to worry about recompiling.

I'm glad I finally got over my initial irritation with log4net, because this solution works like a charm.