2016-11-16 54 views
3

我一直在争论这个问题很长一段时间。当我尝试登录到Oracle 11g数据库中的Number(38,0)字段时。我得到这个错误:登录到Oracle数据库字段时,Log4net记录到Oracle抛出错误?

log4net:ERROR [AdoNetAppender] ErrorCode: GenericFailure. Exception while writing to database System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)

 <parameter> 
     <parameterName value=":my_param" /> 
     <dbType value="Int32" /> 
     <layout type="log4net.Layout.PatternLayout"> 
      <conversionPattern value="%property{my_param}" /> 
     </layout> 
     </parameter> 

我已经尝试设置为Int32大小。我已经尝试了十进制和十进制,并设置了比例和精度。我不确定还有什么要做,但我知道目前的价值是数字。

下面是一些代码调用记录器的值被默认在何处记录和也。

log4net.LogicalThreadContext.Properties[":my_param"] = 132; 
log.Info("Application Start"); //Error occurs here in the output window 

回答

2

你想,当你添加my_param属性的LogicalThreadContext以消除结肠。

log4net.LogicalThreadContext.Properties["my_param"] = 132; 

目前你的财产%语法的使用不匹配与您要添加的属性的名称。

+0

我已经想通了,但却没能回答我的问题。谢了哥们。 –