This release should be as optimized as it gets.
Oscar, indicated the importance of getting the accurate hostname when in a clustered environment.
He suggested doing so with:
hostname = CreateObject("java", "java.net.InetAddress").getLocalHost().getHostName();
Which from my research, is the best approach. However, as Rob mentioned in his comment, the idea of creating an object on every exception could create a nasty performance drain. Well, we all know Luis has packed Coldbox with all kinds of goodies, and of course in his ‘utilities’ plugin he already had a method to getInetHost(), which does exactly what Oscar suggested. Except, since its a CB plugin, its already loaded and cached for us. So I now call a cached object’s method when the BugLog plugin initializes and I store it in the instance data.
Next, had to get rid of the CFINVOKE, and not by replacing it with a CreateObject. The best way to do this is with lazy loading. You don’t want to create and stash the webservice object in the plugin instance at creation, because CB plugins are initialized with the framework. Lazy loading will create the object the first time it is needed, and will persist as long as the plugin itself exists. Which you can define with the CACHE settings in the plugin metadata.
This is what the latest version looks like:
If you didn’t notice, I now allow for you to pass in the Message, and Severity Code, along with the Exception Bean. The code in your exception handler should look something like this:
oExceptionBean = exceptionBean,
sMessage = exceptionBean.getMessage(),
sSeverityCode = 'onException');
Hope this helps out, I will be updating the original post. Be sure to check that out if you haven’t it contains useful information for those who are just getting this setup.