Hi,
I did this previously. I found out the code to use by digging though the source code starting from the ErrorSignal.FromCurrentContext().Raise(ex); method.
This currently only logs to the Database (as thats all i needed) but with a little bit more investigation you could write a wrapper method that logs to whatever you have set-up in the config file.
try
{
Elmah.SqlErrorLog ErrorLog = new Elmah.SqlErrorLog(ConfigurationManager.ConnectionStrings["Default"].ConnectionString);
ErrorLog.ApplicationName = "AppName";
ErrorLog.Log(new Error(new Exception("example"));
}
catch (Exception ex)
{
//catch sql error
}
In my service I made the ErrorLog variable a public singleton object that was easily accessed from the service project.
Hope this helps,
K