Thanks for trying to help, Roy.
 
I don't know what you mean by "generic classes".
 
I had exceptions logging for years now with the exception making it to MY 
simple sproc that takes the exception param as an XML sql data type.
 
Suddenly it stopped working in development. Anything with a stack trace that 
had <> symbols in it would fail to log. This would fail in the sqldata lib 
because it's not an XML format, of course.
 
I tried backing out to the old log4net dll and I'm still getting the failure. 
Now I have no idea what is going on. I'm sure log4net is a wonderful 
architecture, but I find it difficult to just jump in and debug. I suspect it's 
something one needs to really study for a while to get a handle on the 
architecture. I've never dug very deep.
 
I thought the xml representation (serialization) of the exception was being 
done for in previously.
 
I just tried to change that log4net param binding to 
"log4net.Layout.ExceptionLayout" (total guess, frankly) and now I noticed this 
exception in the console output:
 log4net: Setting Property [ParameterName] to String value [@details]
log4net: Setting Property [DbType] to DbType value [String]
log4net: Setting Property [Size] to Int32 value [4000]
log4net:ERROR XmlHierarchyConfigurator: Cannot find Property 
[conversionPattern] to set object on [log4net.Layout.ExceptionLayout]
log4net: Setting Property [Layout] to object 
[log4net.Layout.Layout2RawLayoutAdapter]
log4net: Setting Collection Property [AddParameter] to object 
[log4net.Appender.AdoNetAppenderParameter]
log4net: reated Appender [SQLAppender]
log4net: Adding appender named [SQLAppender] to logger [root].
<appender name="SQLAppender" type="log4net.Appender.AdoNetAppender">
  <bufferSize value="1" />
  <!-- connection string is set later -->
  <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, 
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

  <!-- SystemName and SystemTag params are added dynamically and set by the 
calling application -->
  <commandText value="EXEC log.RecordEvent @SystemName=@system_name , 
@SystemTag=@system_tag , @Severity=@log_level , @Description=@message , 
@Details=@details" />
 
  <parameter>
    <parameterName value="@log_level" />
    <dbType value="String" />
    <size value="5" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%-level" />
    </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="@details" />
    <dbType value="String" />
    <size value="4000" />
    <layout type="log4net.Layout.ExceptionLayout">
      <conversionPattern value="&lt;DETAILS&gt; 
&lt;EXCEPTION&gt;%exception&lt;/EXCEPTION&gt; &lt;/DETAILS&gt;" />
    </layout>
  </parameter>
</appender>



________________________________
From: Roy Chastain <r...@roychastain.org>
To: Log4NET User <log4net-user@logging.apache.org>; Todd 
<todd_beaul...@yahoo.com>
Sent: Wednesday, October 19, 2011 6:55 PM
Subject: RE: Did the exception format change from XML -> string in 1.2.11?

Looks like generic classes to me.
What "sproc" are you referring to?

----------------------------------------------------------------------
Roy Chastain




-----Original Message-----
From: Todd [mailto:todd_beaul...@yahoo.com] 
Sent: Wednesday, October 19, 2011 14:13
To: log4net-user@logging.apache.org
Subject: Did the exception format change from XML -> string in 1.2.11?

Hello,

I've been using log4net for a few years now. I wrapped it my own library
and forgot all about the internals until now ...

I grabbed the latest version and now I can't log any exceptions,
APPARENTLY because the format changed. My sproc expects the xml payload,
but I now seem to be getting a formatted string. The stacktrace in the
string can contain "<>", which causes the call to the sproc to fail.
(it's expecting xml data, but only sees xml brackets inside)

An example of a logged exception using 1.2.10:

<System.NullReferenceException>
  <Message>Object reference not set to an in
  <StackTrace>
    <Frame>MyCompany.Web.CMS.ContentReposito ...
    <Frame>MyCompany.Web.CMS.Repository.Fron ... 
    <Frame>MyCompany.Web.CMS.ContentReposito ...
    <Frame>MyCompany.Web.Corporate.Services. ...
  </StackTrace>
  <Data>
    <hostAddress>66.249.67.244</hostAddress>
  </Data>
</System.NullReferenceException>

An example of what log4net is trying to pass in with 1.2.11:

at MyCompany.Web.Corporate.Controllers.
C:\dev\IQ\Tfs2010\ExternalWeb\Corporate ...
at lambda_method(Closure , ControllerBa ...
at System.Web.Mvc.ActionMethodDispatche ...
at
System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeAction
MethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvok ...
at System.Web.Mvc.ControllerActionInvok ...

Can anyone help me wrap my brain around why this is happening and a
possible solution? 

Thank you.

Reply via email to