I am trying to log exceptions into a database with Log4Net. I am using the adonetappender and it does work, but not optimally.
If I configure the exception parameter like this...
<parameter>
  <parameterName value="@exception"/>
  <dbType value="String"/>
  <size value="-1"/>
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%exception"/>
  </layout>
</parameter>
It works but inserts "" instead of null when there is no exception.
I get the same result if I have it like this...
<parameter>
  <parameterName value="@exception"/>
  <dbType value="String"/>
  <size value="-1"/>
  <layout type="log4net.Layout.ExceptionLayout">
    <!-- <key value="exception" /> -->
    <!--<conversionPattern value="%exception"/>-->
  </layout>
</parameter>
But if I have it like this
<parameter>
  <parameterName value="@exception"/>
  <dbType value="String"/>
  <size value="-1"/>
  <layout type="log4net.Layout.RawPropertyLayout">
    <key value="exception" />
  </layout>
</parameter>
It only inserts null values ...
The problem might be coming from that we have a static logging wrapper that always calls
LogManager.GetLogger("[GoodLife.Common.Logging]").Debug(message, e); // e being null if there is no exception. 
Is there a way for me to have it insert nulls if e is null when I call the debug method on the logger?
The log4net documentation on the layouts isn't all that helpful and I got the last configuration from Default values for AdoNetAppender parameter