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.
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.
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.
To use the event log:
System.Diagnostics.EventLog.WriteEntry()
Or look at a library like log4net or ELMAH.
Kindness,
Dan