views:

38

answers:

2

In my mvc application i need to check a condition in action and throw it to the log.

How can i add a info to log info.

A: 

Have you tried using EMAB or Log4Net libraries?

Yes...there are built-in classes but instead of building it ground-up the best method is to use established frameworks.

Check this out >>> MS Logging Application Block
And if your needs are at a very basic level the System.IO.Log should suffice.

For unhandled errors ELMAH is the easiest to use.

Shankar Ramachandran
can't we do this with any build in classes
santose
+2  A: 

To use the event log:

System.Diagnostics.EventLog.WriteEntry()

Or look at a library like log4net or ELMAH.

Kindness,

Dan

Daniel Elliott