logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sachin Nair <sachin.r.n...@gmail.com>
Subject Unable to log to database
Date Tue, 25 May 2010 09:06:55 GMT
I am using powershell to log some information to database. Here are the

1. Code: Log4NetTest.ps1
2. Configuration file : log4net.xml
3. Table :
              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

Output : output.txt

All the files can be found in the attached zip file.
Please modify the connection string in the xml file.

When we have all the things like i mentioned nothing gets written to the
database instead i get an error mentioned in the output.txt file.
It seems that there is some issues with the data types for the parameters
I've mentioned in the XML file. I say this because if i comment all the
other parameters except the date i.e. *@log_date *everything works fine i
see the logs in the table provided the other columns are set to have null
values. By the way i am using SQLSever2008 for the database.

I would really appreciate it if anyone can look into this and help me out.

Thanks in advance :)

Warm Regards
Sachin Nair

View raw message