我想使用log4net在表中记录自定义错误 [英] I want to log custom error in table using log4net

查看:97
本文介绍了我想使用log4net在表中记录自定义错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用webapplicaton,我能够在表格中存储日志错误(默认由log4net提供)。



但是我想添加一些更多列,并希望将该字段中的错误存储到。



CREATE TABLE [dbo]。[日志](



[Id] [int] IDENTITY(1,1)NOT NULL,



[Date] [datetime] NOT NULL,



[线程] [varchar](255)NOT NULL,



[等级] [varchar](50)NOT NULL ,



[Logger] [varchar](255)NOT NULL,



[留言] [varchar ](4000)NOT NULL,



[例外] [varchar](2000)NULL









现在想增加上表中的3列。

1. ErrorSource

2. ErrorCode(API状态错​​误代码)

3. StackTrace



那么如何使用log4net库来使用自定义日志?



任何帮助都会有所帮助吃了吗?



我尝试了什么:



如何使用log4net存储登录数据库Sadi02的博客 [ ^ ]



我使用了上面的链接并成功保存了日志。现在,我如何使用log4net库使用自定义日志?

I am using webapplicaton and i am able to store the log error(default which is provided by log4net)in the table.

But i want to add some more column and want to store the error in that field to.

CREATE TABLE [dbo].[Log] (

[Id] [int] IDENTITY (1, 1) NOT NULL,

[Date] [datetime] NOT NULL,

[Thread] [varchar] (255) NOT NULL,

[Level] [varchar] (50) NOT NULL,

[Logger] [varchar] (255) NOT NULL,

[Message] [varchar] (4000) NOT NULL,

[Exception] [varchar] (2000) NULL

)


Now want to increase the 3 column in above table.
1. ErrorSource
2. ErrorCode(API Status Error Code)
3. StackTrace

So how can i use custom log using log4net library?

Any help would be appreciated?

What I have tried:

How to store log in database using log4net | Sadi02's Weblog[^]

I have used above link and successfully saving the log. Now So how can i use custom log using log4net library?

推荐答案

请关闭此问题。我只想弄清楚这个问题。以下是链接。谢谢。



c# - Log4Net,如何在我的日志记录中添加自定义字段 - Stack Overflow [ ^ ]
Please close this question. I just figure out the issue. Below is the link. Thanks.

c# - Log4Net, how to add a custom field to my logging - Stack Overflow[^]


这篇关于我想使用log4net在表中记录自定义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆