English 中文(简体)
总的伐木是新的,但在MVC3申请中,我应当做些什么?
原标题:New to logging in general, but what should I log in an MVC3 application?

I m really new to logging, and I ve decided it s time to take the plunge and start working it into my applications from now on.

当我听说要非常快和简单地设立时,我将使用Nlog。

What type of information should I be concerned about logging? What information should be considered superfluous and unnecessary?

关于更具体的内容,我应当把我的<代码>-logger.Info(“Foo”);打电话? 在我控制员的每项行动范围内?

最佳回答

You should look at ELMAH It is the easiest thing to setup using nuget. And it provides awesome logging for asp.net MVC (logs all exceptions and the request associated with it), all the effort you have to do is to install the package in your application. :)

http://code.google.com/p/elmah/

问题回答

不能用字或二来解释伐木的重要性。

伐木是你申请支持L2和L3小组调查的一个重要部分。 他们需要标识来应对所发生的事情、 b等等。

Since logging forms non functional concern of any application, it is a cross cutting concern in terms of Aspect Oriented Programming, many aop frameworks like aspectJ is used in the Java development wing to implement logging, together with mature loggers.

http://www.dotnetlogging.com/ 提供良好的网络砍伐工具

我们使用标志4net和ELMAH。 ELMAH被用于任何顶级或未经处理。

我们每种方法的标识(log4net)。 我们撰写了一份宏观文件,以注射伐木/游览法(尽管有一份产品,将这一仪器列入你汇编的法典)。

For other steps we log out debug info (loading record id 15) log.Debug(...) other times info "processing customer JOHN using log.Info(..) when we catch an exception we log.Error()

然后,我们部署我们的应用,确定我们的伐木水平,以便第一次停下来,然后在顺利运行后,转向“信息”。

这提供了相当详细的内容,但应由您来决定。 只是说,我们几乎每个方法都有详细的记录。

你们在追捕例外和记录例外时也记得,现在又重新接纳了这些例外。 IE DO NOT

throw ex;

正义

throw;

log4net can be found here: http://logging.apache.org/log4net/ and a nuget package is available for automatic configuration at http://nuget.org/List/Packages/log4net

ELMAH is available via nuget as well for automatic configuration although there are extra steps you need to take to work with MVC. Check out: How to get ELMAH to work with ASP.NET MVC [HandleError] attribute?





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签