You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Sachin Nair <sa...@gmail.com> on 2010/05/25 11:06:55 UTC
Unable to log to database
Hi,
I am using powershell to log some information to database. Here are the
details.
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