我正在编写一个 ASP .NET MVC3 应用程序,并且由于应用程序预计是安全的,因此我需要一个良好的企业应用程序日志记录架构。
因此,我在寻找现有的登录框架并选择了 NLog。因此,此时我一直致力于为日志创建数据库模式。
有人在这方面有好的经验吗?它预计会记录一组操作,例如用户与系统对象的交互、后台工作、用户会员操作、支付交易等。
I'm writing an ASP .NET MVC3 application and as application is expected to be secure, I need a good enterprise application logging architecture.
So I was seeking over existing loggin frameworks and picked the NLog. So at them moment I'm stuck with making DB schema for logs.
Does anyone have good experience in this area? It's anticipate to log a set of actions such as user interactions with system objects, background works, user membership actions, payment transactions and so on.
发布评论
评论(2)
我已经使用 NLog 一段时间了,我对它非常满意。我最喜欢 NLog 的是,您可以配置不同的日志级别以写入不同的文件和/或数据库。这是一个非常强大的日志库。
要记录到数据库,您可以在配置中使用如下所示的内容。这与我在我工作的公司使用的类似。
您可以使用规则部分将不同级别记录到不同文件,请参见下面的示例;
编辑:添加了用于记录信息的可能的表格布局。
上面的布局只是一个粗略的想法。这完全取决于您想在此表中记录什么。尽管您必须尝试是否可以添加除 NLog 默认使用的参数之外的其他参数。
I've been using NLog for a while now and i'm very happy with it. What I most like about NLog is that you can configure different loglevels to be written to different files and/or databases. It's a very powerfull logging library.
For logging to the database you can use something like below in your config. This is similar to what I use at the company i'm working.
You can use the rules section to log different levels to different files, see example below;
EDIT: Added possible table layout for logging information.
The layout above is just an rough idea. It totally depends on what you want to log in this table. Though you have to try if it's possible to add additional paramaters other than the ones used by NLog by default.
就像 Rob 的回答一样..坚持使用 NLog :)
如果您需要一个好的查看器,请不要忘记使用 Sentinal 作为免费的 nLog 查看器:)
不要忘记,您可以在生产过程中以编程方式打开日志记录部分..以查看网站的特定区域。然后使用 Sentinal 实时查看它们。
另一种选择是利用类似 LoggR.net。这会实时传输数据(即本例中的错误或日志信息)。我认为它使用了很棒的 SignalR 框架来使用 WebSockets 或长轮询(2 种实时技术):)
Like Rob has answered .. stick with NLog :)
If you need a good viewer, don't forget to use Sentinal as a free nLog viewer :)
Don't forget, you can programatically turn on logging sections, while in production .. to view specific areas of the website. And then see them in real-time using Sentinal.
another option is to take advanctage of something like LoggR.net. This streams data (ie. errors or logging information in this case) in real time. I think it's using the awesome SignalR framework to use WebSockets or Long Polling (2 real-time technologies) :)