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 "Nicko Cadell (JIRA)" <ji...@apache.org> on 2005/05/03 12:27:12 UTC

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

AdoNetAppender does not support inserting NULL into columns
-----------------------------------------------------------

         Key: LOG4NET-28
         URL: http://issues.apache.org/jira/browse/LOG4NET-28
     Project: Log4net
        Type: Bug
  Components: Appenders  
    Versions: 1.2.9    
    Reporter: Nicko Cadell
 Assigned to: 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.
-
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


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

Posted by "Greg Peterson (JIRA)" <ji...@apache.org>.
    [ 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.


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

Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-28?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564526#action_12564526 ] 

Ron Grabowski commented on LOG4NET-28:
--------------------------------------

Its generally a good idea to post general questions about log4net to the mailing lists first. This issue has been closed for almost 3 years.

Are you using a RawPropertyLayout layout?

 <parameter>
  <parameterName value="@productId" />
  <dbType value="String" />
  <size value="50" />
  <layout type=" log4net.Layout.RawPropertyLayout">
   <key value="ProductId" />
  </layout>
 </parameter> 

 log.Debug("Message");
 // snip
 IDbDataParameter param = (IDbDataParameter)command.Parameters["@productId"];
 Assert.AreEqual(DBNull.Value, param.Value);

> 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.


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

Posted by "Greg Peterson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-28?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564471#action_12564471 ] 

Greg Peterson commented on LOG4NET-28:
--------------------------------------

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.


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

Posted by "Nicko Cadell (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/LOG4NET-28?page=all ]
     
Nicko Cadell resolved LOG4NET-28:
---------------------------------

    Resolution: Fixed

Fix to AdoNetAppenderParameter FormatValue to convert the null runtime value to DBNull value.

> AdoNetAppender does not support inserting NULL into columns
> -----------------------------------------------------------
>
>          Key: LOG4NET-28
>          URL: http://issues.apache.org/jira/browse/LOG4NET-28
>      Project: Log4net
>         Type: Bug
>   Components: Appenders
>     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.
-
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