I have a customer's DNN site with a custom module that's having issues with module error logging. The site was upgraded to version 7.4 from 6.2 and now to version 9.0. Module exceptions no longer appear in Admin / Host Events since the upgrade to 7.4. It appears module exception logging was changed in DNN 7.4 as explained here. This is the code that worked before but now nothing gets logged;
Test object:
public class foo
{
public int id { get; set; }
public string bar { get; set; }
}
Test webapi Controller:
[DnnAuthorize]
public class MyCustomModuleController : DnnApiController
{
private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(MyCustomModuleController));
[HttpGet]
public HttpResponseMessage GetFoo(int id)
{
try
{
foo test = null;
var bar = test.bar; //will throw null exception
...
}
catch (Exception ex)
{
Logger.Error(ex); //no log entries in db since ver. 7.4
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Server error");
}
}
Is there a setting that I should enable or is there a new way of logging events?