RE: [coldbox:10450] logBox

You can put whatever information you want into extra info for errors you log yourself. You can also build a custom appender which puts whatever you want in the body of the E-mail.

This is my current setup:
I have a custom exception handler defined that logs the error like so:
logger.error(exceptionBean.getMessage;

Then, in LogBox I have a custom E-mail appender which calls:

local.exceptionBean = logEvent.getExtraInfo();
getColdbox().getExceptionService().renderEmailBugReport(local.exceptionBean).

This uses my custom bug report template (which is based on the default one that has all the handler/event stuff in it) and then I take that string and slap it in an E-mail and send it.

So essentially I’m getting the same E-mail I’d get if bug reports were enabled, but it’s going through LogBox. I also have a database appender configured which logs the same error to the database, and then passes along the reference number so I can include it in the E-mail (and display it on the screen) for later reference.

LogBox didn’t exist back when bug reports were created so that’s why there’s some overlap. It’s in the works to do some work to consolidate that to make it easier to use LogBox to E-mail about your errors.

Thanks!

~Brad

LogBox has also a cool feature called custom layouts, that you can use to customize the content of the log message. You can create a custom layout for the Email Appender that sends much more information as needed. Basically, all your custom messages.

I would go that route.

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

I’m still a newbie when it comes to logBox so please forgive my ignorance.

I found the docs and read them as best as I can understand but I couldn’t figure out where to place the CFC i created to extend the logging/format function.

how does coldbox know to call that? do I put it in the Coldbox.cfc Config File?


Jeremy R. DeYoung
Phone:615.261.8201

RantsFromAMadMan.com

http://wiki.coldbox.org/wiki/LogBox.cfm#Adding_Appenders

When you define the email appender make sure you define the layout component for it:

MyEmail = {
class=“coldbox.system.logging.appenders.EmailAppender”,
layout=“mypath.model.MyEmailLayout”
}

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

awesome, got the custom layout working.

is it possible to override the subject() and get the exception details as well?

if so, how would i go about accessing that information?


Jeremy R. DeYoung
Phone:615.261.8201

RantsFromAMadMan.com

I just added a new commit to the dev branch:

email appender if you create a custom layout and the custom layout has a “getSubject(logevent)” method, it will call it to get the subject of the email line instead of the auto generated one

If the custom layout has a “getSubject()” method, then it will call it to retrieve the subject line dynamically from the layout instead of the generated one. The method receives the log event object.

Squeezed into 3.1

Enjoy!

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

you rock!


Jeremy R. DeYoung
Phone:615.261.8201

RantsFromAMadMan.com

Just ran into the same issue myself with LogBox not using the Bugreport template by default… was pretty easy to use the layout and get it working and get the old emails back again

Blogged about this as well in case someone needs to see the code etc http://www.anujgakhar.com/2012/04/24/replacing-bugtracer-email-functionality-in-coldbox-with-logbox-loggers/