开发者

Problem mapping fields with a Database Target

I am having a problem getting this to work correctly. I tried it with a straight INSERT statement and a Stored Proc also with the same bad results. On the example below, the Version number is ending up in the ErrorMsg field in the database. The Log Level ends up in the UserName. Any idea why is this happening? The commandtext statement is correct.

<target xsi:type="Database"
          name="dberrorlog"
          connectionStringName="Logger"
          keepConnection="true"
          useTransactions="true" >
      <commandText>
        INSERT INTO [Logs].[LogError]
        ([ProgName], [CreatedDate], [CompName], [LogLevel], [UserName], [ErrorMsg], [Version], [SourceMethod], [StackTrace])
        VALUES
        (@ProgName, @CreatedDate, @CompName, @LogLevel, @UserName, @ErrorMsg, @Version, @SourceMethod, @StackTrace)
      </commandText>
      <parameter name="@ProgName" layout="MyProgram"/>
      <parameter name="@CreatedDate" layout="${date:format=MM\-dd\-yyyy HH\:mm\:ss}"/>
      <parameter name="@CompName" layout="${machinename}"/>
      <parameter name="@LogLevel" layout="${level}"/>
      <parameter name="@UserName" layout="${aspnet-user-identity}"/>
      <parameter name="@ErrorMsg" layout="${exception:format=ToString}"/>
      <parameter name="@V开发者_运维百科ersion"  layout="1.0.0.0"/>
      <parameter name="@SourceMethod" layout="${callsite}"/>
      <parameter name="@StackTrace"   layout="${stacktrace:format=Raw}"/>
</target>

Any Help is greatly appreciated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜