This project is read-only.

Would Like to Add More Details to Error Log

Topics: Administration
Dec 3, 2012 at 6:57 PM

Basically, I would like to add some context to the error log.  For example, it would be nice to know what Url was requested when an error occurred.  I considered overriding the DefaultExceptionPolicy in order to do this, but I didn't know if that would be a recommended approach or not.  I'm also not experienced with log4net so maybe there is something built in for this? 

For me, this would be helpful as I have many tenants, and I'm not sure what content, tenant, database, etc. to start looking at to resolve an issue.  

So, is there a nice way to approach this that I haven't thought of? 

Dec 21, 2012 at 2:24 AM

Hi Brandon,

I was just going through the same challenges of trying to figure out where the errors were coming from on my multi-tenant site. Have you come up with a good approach yet? Will let you know what I find as I dig through.

Dec 21, 2012 at 3:21 AM

I have looked through the options for a bit now and what do you think about this:

  • Create a module that implements "ILogger"
    • This way, we can pick up every event that is logged, not just the exceptions
    • By capturing every event, we could possibly inject our own additional elements into a Custom Exception and then use the Orchard Logger to add another log entry (of course there is risk of a continual loop 
    • This all sounded pretty good until I read this link:
      • It looks like neither ILogger or ILoggerFactory implement IDependency so it will be harder to implement

I don't know, seems pretty difficult to tap into that.  Perhaps you are right with your thoughts on using the Default Exception Policy. At least the IExceptionPolicy is an ISingletonDependency so it could be over ridden in another module using SuppressDependancy.  I guess the question in my head is whether the DefaultExceptionPolicy is actually called up every time something is an exception or if there are issues that get logged which it would miss.  Then, in addition to that, because it would be a module (presumably) it would need to be enabled for every tenant to actually function properly.  That seems problematic also.

In short, I don't think I have helped any and am also looking for a better answer.

Dec 21, 2012 at 4:03 AM

Ya, I sorta put this on back-burner, but would still really like a nice solution.  I'll let you know if I come up with anything besides the DefaultExceptionPolicy idea.  Thanks for trying!

Feb 26, 2013 at 6:13 PM
We should vote for this issue: