logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Georg Jansen" <Georg.Jan...@FaktNet.com>
Subject RE: DB logger doesn't log complete exceptions!
Date Sun, 25 Sep 2005 07:06:10 GMT
Hi

When I tried to run your sql create table statment I got the message:

Warning: The table 'Log' has been created but its maximum row size (8603)
exceeds the maximum number of bytes per row (8060). INSERT or UPDATE of a
row in this table will fail if the resulting row length exceeds 8060 bytes.

But I guess if the log you are inserting don't actually exceeds the maximum
row size, the exception column should not be truncated

I am running SQL Server 2000 - 8.00.760

I am running more or less the same configuration as you, but I 
I have set up my log table with maxsize on message to 4000, and maxsize on
exception to 2000. 

I checked my log table and found that the longest value actually stored in
the exception column was 1870 (Select max(DATALENGTH(Exception)) from Log).
This at least is indicating that, it is possible to have long exceptions
logged.

Maybe you should try to reduce one of columns so that the total row size
doesn't exceed the maximum row size.

I don't know is this is any helpful - but just to let you know.

Georg
www.l4ndash.com - Log4Net Dashboard 

-----Original Message-----
From: Ivan Jouikov [mailto:ivan@ablogic.net] 
Sent: 24. september 2005 01:58
To: log4net-user@logging.apache.org
Subject: DB logger doesn't log complete exceptions!

Basically, my exceptions get logged only partially, like this:

ICSharpCode.SharpZipLib.SharpZipBaseException: Unexpected EOF     at
ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.Fill
()     at
ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.Read
LeByte()     at ICSharpCode.Sharp

I have my DB set up with 4000 chars allowed:

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] (4000) NULL
)

And my appender also allows for 4000 chars:

<appender name="ADONetAppender_SqlServer"
type="log4net.Appender.AdoNetAppender">
            <bufferSize value="1" />
            <connectionType value="System.Data.SqlClient.SqlConnection,
System.Data, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
            <connectionString value="data source=localhost;initial
catalog=CDS;integrated security=false;persist security info=True;User
ID=xxx;Password=xxx" />
            <commandText value="INSERT INTO Log
([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES
(@log_date, @thread, @log_level, @logger, @message, @exception)" />
            <parameter>
                <parameterName value="@log_date" />
                <dbType value="DateTime" />
                <layout type="log4net.Layout.RawTimeStampLayout" />
            </parameter>
            <parameter>
                <parameterName value="@thread" />
                <dbType value="String" />
                <size value="255" />
                <layout type="log4net.Layout.PatternLayout">
                    <conversionPattern value="%thread" />
                </layout>
            </parameter>
            <parameter>
                <parameterName value="@log_level" />
                <dbType value="String" />
                <size value="50" />
                <layout type="log4net.Layout.PatternLayout">
                    <conversionPattern value="%level" />
                </layout>
            </parameter>
            <parameter>
                <parameterName value="@logger" />
                <dbType value="String" />
                <size value="255" />
                <layout type="log4net.Layout.PatternLayout">
                    <conversionPattern value="%logger" />
                </layout>
            </parameter>
            <parameter>
                <parameterName value="@message" />
                <dbType value="String" />
                <size value="4000" />
                <layout type="log4net.Layout.PatternLayout">
                    <conversionPattern value="%message" />
                </layout>
            </parameter>
            <parameter>
                <parameterName value="@exception" />
                <dbType value="String" />
                <size value="4000" />
                <layout type="log4net.Layout.PatternLayout">
                    <conversionPattern value="%exception" />
                </layout>
            </parameter>
        </appender>


I think we can all agree that that exception has less than 4000 chars in
it, so any idea on how to fix this?




Mime
View raw message