You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Greg Peterson (JIRA)" <ji...@apache.org> on 2008/01/31 20:39:08 UTC

[jira] Issue Comment Edited: (LOG4NET-28) AdoNetAppender does not support inserting NULL into columns

    [ https://issues.apache.org/jira/browse/LOG4NET-28?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564471#action_12564471 ] 

secretagent edited comment on LOG4NET-28 at 1/31/08 11:38 AM:
----------------------------------------------------------------

The PatternLayout uses SystemInfo.NullText which returns a string "(null)" not the null value. If you use a custom property and set it to null, you will not have the parameter set to DBNull.

The PatternConverter.WriteObject(TextWriter writer, ILoggerRepository repository, object value) calls repository.RendererMap.FindAndRender(value, writer);

which in turn, sets the value to "(null)" because the object value is null.

if (obj == null)
			{
				writer.Write(SystemInfo.NullText);
			}
			else 
			{
.....

Maybe it should be 

if (formattedValue == null || formattedValue.ToString() == SystemInfo.NullText)
			{
				formattedValue = DBNull.Value;
			}


      was (Author: secretagent):
    The PatternLayout uses SystemInfo.NullText which returns a string "(null)" not the null value. If you use a custom property and set it to null, you will not have the parameter set to DBNull.

The PatternConverter.WriteObject(TextWriter writer, ILoggerRepository repository, object value) calls repository.RendererMap.FindAndRender(value, writer);

which in turn, sets the value to "(null)" because the object value is null.

if (obj == null)
			{
				writer.Write(SystemInfo.NullText);
			}
			else 
			{
.....
  
> AdoNetAppender does not support inserting NULL into columns
> -----------------------------------------------------------
>
>                 Key: LOG4NET-28
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-28
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.9
>            Reporter: Nicko Cadell
>            Assignee: Nicko Cadell
>            Priority: Minor
>             Fix For: 1.2.10
>
>
> The AdoNetAppender does not support inserting NULL values into columns.
> If a column allows NULL values then the AdoNetAppender should allow NULL values to be inserted. For most value types this means using the DBNull value for the parameter. The AdoNetAppenderParameter should convert CLI null values into DBNull values before setting the parameter value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.