RE: [coldbox:12496] Re: What do you need to get the ExeptionBean to work?

11:58:45.045 - Database Exception - in C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\CustomTags\com\adobe\coldfusion\base.cfc : line 364
Error Executing Database Query.

This error is quite possibly being try/caught somewhere and not re-thrown. You’ll need to figure out why if that is the case.

Obviously, ColdBox can only handle errors which it as allowed to catch. If you need more information about the error and are unable to find the try/catch block which is hiding it, running SQL Profiler might help. (Assuming you are on MS SQL) Also, the standard ColdFusion logs may provide a complete stack trace for the error.

If I take a new folder and create a simple application.cfm and index.cfm and call the objects in the handler I get a clearer picture as to what might be wrong with the object or query.

I’m not sure if I’m following that-- Are you saying that the error IS thrown when you run the same code outside of ColdBox?

How can I get ColdBox to give me that information using LogBox in an email and display a nice error to the customer?

This is two questions. The first, is how can I get information about the error with LogBox. In short, you can’t if ColdBox isn’t catching the error. Minimally, you need to configure the E-mail appender. (see below)

Your second question was how to display a pretty page to the user. That is the customErrorTemplate setting. Point it to a .cfm file which will be cfincluded. In production, mine is:
customErrorTemplate = “views/assets/callCustomerService.cfm”, // Sorry, please call customer service

On dev, it is:
coldbox.customErrorTemplate = ‘/common/views/assets/BugReport.cfm’; // Normal debug output of error information

It is important to note that the custom error template will not be included if you do a setNextEvent() in your exception handler. Plus, if you implement a exception handler, it’s up to you to log the error. I have more/less the following in my exception handler:

<cfset variables.logger = variables.logBox.getLogger(getSetting(“AppName”))>
<cfset logger.error(exceptionBean.getMessage(),exceptionBean)>

It’s also worth noting that a coldbox.customErrorTemplate should be a stand-alone .cfm file which doesn’t use the framework. If the framework is having troubles starting up, it may not be able to display a standard event which can put you in a nasty loop.

Can someone give me a one or two page example…

Sorry, I’ve got to get back to work, but perhaps someone else can throw a working example together.

In lieu of a full example, here is a chunk of logbox config (untested) that should define an E-mail appender that only E-mails Error and Fatal messages, but logs everything but debug to a text file:

//LogBox DSL
logBox = {
// Define Appenders
appenders = {
logFile =
class = “coldbox.system.logging.appenders.AsyncRollingFileAppender”,
levelMax=3, // Info
properties =
filepath = “D:\logs",
autoExpand = false,
filename = “myLogFile”,
fileMaxSize = 2000,
fileMaxArchives = 20
email = {
properties = {
subject = “”,
from = “myemail”,
to = “myemail”
// Root Logger
root = { levelMin = “FATAL”, levelMax = “INFO”, appenders=”*" },
“coldbox.system” = { levelMin = “OFF”, levelMax = “OFF” }

Couple that with the customer error template setting above and that should E-mail you about errors, but display a pretty message to the user.