How do I configure NLog to write to a database?

前端 未结 4 1298
走了就别回头了
走了就别回头了 2020-12-24 12:21

I\'m trying to get NLog to write to a database, however with my current code it throws an exception when I attempt to debug, the exception is: The type initializer for \'Not

4条回答
  •  一向
    一向 (楼主)
    2020-12-24 13:24

    A simple example,

    Config:

    
      
        INSERT INTO NLogEntries ([Origin], [Message], [LogLevel],[CreatedOn],[OrderId]) VALUES (@Origin,@Message,@LogLevel,@Date, @OrderId);
      
      
      
      
      
       
    
    

    Note, NLog 4.6 has also support for DbType - See https://nlog-project.org/2019/03/20/nlog-4-6-is-live.html

提交回复
热议问题