[ http://issues.apache.org/jira/browse/LOG4NET-89?page=all ]
Haacked updated LOG4NET-89:
---------------------------
Description:
I know a fix for this has been issued, but I think there is still a bug. I have
a stored procedure I use with my AdoNetAppender in Subtext
(http://subtextproject.com/ source code in SVN at
https://svn.sourceforge.net/svnroot/subtext/).
The stored proc has an Int32 parameter (@BlogId) that may be null in certain
situations). When I trace through the Log4Net code, I notice that it obtains a
formatted value within AdoNetAppender.cs line 1167. It then compares that
value to null, and if it is null, sets the formattedValue to DBNull.Value.
object formattedValue = Layout.Format(loggingEvent);
// If the value is null then convert to a DBNull
if (formattedValue == null)
{
formattedValue = DBNull.Value;
}
param.Value = formattedValue;
However, when I check the value of formattedValue, it is the string "(null)"
and not a null reference. I traced the code all the way to the FindAndRender
method of RenderMap.cs line 113 which begins like so:
if (obj == null)
{
writer.Write(SystemInfo.NullText);
}
I don't know this code well enough to know whether the proper patch is to
update AdoNetAppender.cs line 1167 to be:
if (formattedValue == null || formattedValue.ToString() ==
SystemInfo.NullText)
Or if the proper fix is elsewhere.
ATTACHMENTS:
subtext_AddLogEntry.txt - The stored proc I am trying to call.
AdoNetAppender.txt - The AdoNetAppender configuration in my web.config.
AdoNetAppenderException.txt - The exception I get.
was:
I know a fix for this has been issued, but I think there is still a bug. I have
a stored procedure I use with my AdoNetAppender in Subtext
(http://subtextproject.com/ source code in SVN at
https://svn.sourceforge.net/svnroot/subtext/).
The stored proc has an Int32 parameter (@BlogId) that may be null in certain
situations). When I trace through the Log4Net code, I notice that it obtains a
formatted value within AdoNetAppender.cs line 1167. It then compares that
value to null, and if it is null, sets the formattedValue to DBNull.Value.
object formattedValue = Layout.Format(loggingEvent);
// If the value is null then convert to a DBNull
if (formattedValue == null)
{
formattedValue = DBNull.Value;
}
param.Value = formattedValue;
However, when I check the value of formattedValue, it is the string "(null)"
and not a null reference. I traced the code all the way to the FindAndRender
method of RenderMap.cs line 113 which begins like so:
if (obj == null)
{
writer.Write(SystemInfo.NullText);
}
I don't know this code well enough to know whether the proper patch is to
update AdoNetAppender.cs line 1167 to be:
if (formattedValue == null || (formattedValue as string) == "(null)")
ATTACHMENTS:
subtext_AddLogEntry.txt - The stored proc I am trying to call.
AdoNetAppender.txt - The AdoNetAppender configuration in my web.config.
AdoNetAppenderException.txt - The exception I get.
> Still A Problem Inserting Null Value For Int32 Values
> -----------------------------------------------------
>
> Key: LOG4NET-89
> URL: http://issues.apache.org/jira/browse/LOG4NET-89
> Project: Log4net
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 1.2.10
> Environment: Windows XP .NET 2.0
> Reporter: Haacked
> Attachments: AdoNetAppender.txt, AdoNetAppenderException.txt,
> subtext_AddLogEntry.txt
>
>
> I know a fix for this has been issued, but I think there is still a bug. I
> have a stored procedure I use with my AdoNetAppender in Subtext
> (http://subtextproject.com/ source code in SVN at
> https://svn.sourceforge.net/svnroot/subtext/).
> The stored proc has an Int32 parameter (@BlogId) that may be null in certain
> situations). When I trace through the Log4Net code, I notice that it obtains
> a formatted value within AdoNetAppender.cs line 1167. It then compares that
> value to null, and if it is null, sets the formattedValue to DBNull.Value.
> object formattedValue = Layout.Format(loggingEvent);
> // If the value is null then convert to a DBNull
> if (formattedValue == null)
> {
> formattedValue = DBNull.Value;
> }
> param.Value = formattedValue;
> However, when I check the value of formattedValue, it is the string "(null)"
> and not a null reference. I traced the code all the way to the FindAndRender
> method of RenderMap.cs line 113 which begins like so:
> if (obj == null)
> {
> writer.Write(SystemInfo.NullText);
> }
> I don't know this code well enough to know whether the proper patch is to
> update AdoNetAppender.cs line 1167 to be:
> if (formattedValue == null || formattedValue.ToString() ==
> SystemInfo.NullText)
> Or if the proper fix is elsewhere.
> ATTACHMENTS:
> subtext_AddLogEntry.txt - The stored proc I am trying to call.
> AdoNetAppender.txt - The AdoNetAppender configuration in my web.config.
> AdoNetAppenderException.txt - The exception I get.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira