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 "Atif.Sarfraz" <At...@kerzner.com> on 2007/04/05 21:18:07 UTC
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