Ok, I’ve got an interesting brainstorm about LogBox. We just upgraded our app at work to M5 to see how everything works out. Of course, that now means that we’re using the new and improved Logging engine! It also seems like a good time to get around to making an enhancement we’ve had on our books for a while. Right how when CB handles an error in our app, the standard Big Report E-mail gets sent out, and we log the error to a log file. With the new Logger functionality, we’ll implement a DBAppender to start keeping our errors in a database table to better keep track of them.
As part of this change we are going to start generating an error reference number on the generic “call customer service” page. That way when someone calls in or E-mails a screen shot we can match the error reference number they give us with the specific error detail in our logs. (A lot of our site is public accessed so there is no logged in user to tie the error to)
Ok, so no problem, right? I’ll just write a custom database appender that inserts the error report, and grabs the last error number that was created. But the problem is how can I get that info back to the app. Right now appenders are sort of a black hole. For all my app knows, the appender could have run asynchronously or not at all. I could make the service or handler that logs the error generate the number ahead of time, but if it is a simple identity column, I won’t know the next ID until I insert it. Either that or I’ll have to single-thread the entire process to make sure only one error gets logged at a time. (yuck!)Alternatively, I could place the reference number in the request scope somewhere and pull it out later (assuming the appender is synchronous). but that just seems to poo all over the face of encapsulation.
Does anyone have any bright ideas or thoughts on this? If your only thought is that I’m pushing LogBox too far, then feel free to tell me that too.