I am using log4net code found at: http://logging.apache.org/log4net/release/sdk/log4net.Appender.AdoNetAppender.html
How do I write the code behind to insert the information in to the table?
I am using log4net code found at: http://logging.apache.org/log4net/release/sdk/log4net.Appender.AdoNetAppender.html
How do I write the code behind to insert the information in to the table?
MVC has no codebehind... you put it in the controller. First put the log4net configuration to use that appender in the config file (they give the appender config and SQL table info on that page you gave). Now in your controller you need a logger private in your controller:
private log4net.ILog log;
and now in the ctor of the controller (if it does not have one create it) you need to initialize the logger.
log4net.Config.XmlConfigurator.Configure();
log = log4net.LogManager.GetLogger(this.GetType());
now in your action you can log away...
log.Error("I lost my wookie");
or
try
{
int x = 0/3;
log.Info("The divide by zero didnt fail? Why?");
}
catch(Exception ex)
{
log.Error(ex);
}