Saturday, February 04, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: DB logger doesn't log complete exceptions!
Prev Next
You are not authorized to post a reply.

Author Messages
Ivan Jouikov

09/24/2005 1:57 AM  

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?

Georg Jansen

09/25/2005 9:06 AM  

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

Matthew Brown

09/25/2005 9:09 PM  
A 4000 character column seems ridiculously large anyway, even if you went with varchar to save space (as Georg pointed out, a single row in that table would take up 8k of disk space).

Why not just use text columns?

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > DB logger doesn't log complete exceptions!



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement