The message doesn't get logged at all, if I remove the complete entry 
<size value="99000" />  or set it to  <size value="" />

My problem is that the XML document is dynamic and can be anywhere from a few 
thousand characters to maybe close to 500,000 or more. Setting the column size 
as NText does take care of this issue from the database end. However I am not 
sure what size to set in log4Net (safely I can set the size to a very high 
value like 500,000 or something but I am not sure if that will have side 
effects to my application in production environment). Please note that if I set 
the size to a high value like 500,000 the message does gets logged completely 
and without an error.

Regards,
Atif Sarfraz
Senior Application Developer 
Information Technology
Kerzner International North America, Inc.
1000 South Pine Island Road, Suite 800, 
Plantation, FL 33324-3907 
Telephone 954-809-2131 
Email: [EMAIL PROTECTED]

-----Original Message-----
From: Ron Grabowski [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 05, 2007 10:17 PM
To: Log4NET User
Subject: Re: Logging large messages using ADO.NET appender

Do you get an error when you don't specify the size? 9,900 is quite large for a 
message. Are you approaching the limit?

----- Original Message ----

From: Atif.Sarfraz <[EMAIL PROTECTED]>

To: [email protected]

Sent: Thursday, April 5, 2007 3:48:55 PM

Subject: Logging large messages using ADO.NET appender



Logging large messages using ADO.NET appender     



 



  Hi,

 I am trying to log a large XML message whenever there is an exception in our 
application. I have defined my table as follows, i.e. setting the Message 
column as ntext.

 CREATE TABLE [dbo].[ Log](

         [Id] [int] IDENTITY(1,1) NOT NULL,

         [Date] [datetime] NOT NULL,

         [Machine] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

         [Thread] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,

         [Level] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,

         [Logger] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,

         [Message] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,

         [Exception] [varchar](2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

  CONSTRAINT [PK_APP_Log] PRIMARY KEY CLUSTERED 

 (

         [Id] ASC

 )WITH FILLFACTOR = 90 ON [PRIMARY]

 ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

 

 

 Since I am not sure about the actual size of the message I have defined the 
parameter as equal to 99000 characters. Is this the right way of doing this, or 
is there any other way by which I can tell Log4Net to log all the message 
without specifying the size here. 

 (Note: My messages do get logged properly using this approach but I don’t want 
to give a fixed size here).

 

 <parameter>

 <parameterName value="@message" />

         <dbType value="String" />

         <size value="99000" />

         <layout type="log4net.Layout.PatternLayout">

                 <conversionPattern value="%message" />

         </layout>

 </parameter>

 

 Regards,

 Atif Sarfraz



 










Reply via email to