Detailed Debug Output in IIS7 and Coldfusion

I setup a new IIS7 site with Coldfusion the other day and found that it didn’t matter what debug settings I set in CF administrator, IIS continued to hand me the standard 505 error page.

That’s perfect for a production site, but I’m still doing dev work here. The fix is — like so many Microsoft fixes — hidden away in IIS7.

  1. Open IIS Manager
  2. Traverse to the site you’re interested in and view the settings home
  3. Open the “Error Pages” option in the IIS group.
  4. On the right Actions menu, click “Edit Feature Settings”
  5. In the popup box, select:
    1. “Detailed Errors for local requests…” if you’re serving from your local machine,
    2. “Detailed errors” if you’re serving from any other machine

 

Using RegEx and Java to Split a String in Coldfusion

I was looking for a great way to split a string using a regex expression. Ben Nadel had a good post where he’s creating an RESplit() method. This was a little more than I wanted to go into, and after some more searching I found the solution was to use Java (usually is the solution ;-) as shown by Raymond Camden. So without further discussion, here’s what you need:

// Splitting a query column value by linefeeds
// You could just as easily do this with any RegEx
ItemsArray = myQuery.Notes[1].split( chr(13) );

Regular Expression to match most International phone numbers in US notation

So here’s a little RegEx I’ve whipped up that will match all of the following phone number notation styles:

^[\+]?[\d]{0,3}[\-|\s]?[\(]?[\d]{3}[\)|\-]?[\s|\d]?[\d]{2,3}[\-]?[\d]{3,4}$

EDIT: Fellow Google Pluser Bradley Moore took a crack at my expression above and cleaned it up a bit. Here’s the update:

^\+?\d{0,3}[ -]?\(?\d{3}\)?[ -]*\d{3}[ -]*\d{4}$

555-555-5555

555 555-5555

5555555555

15555555555

+15555555555

1-555-555-5555

+1-555-555-5555

+12 555-555-5555

+1 (555) 555-5555

(555) 555-5555

Change JRun and Coldfusion Log Locations

Best practices dictates that we store our log files on a different drive than the host OS. The idea is to protect our OS in the event our logs get to large (possible if rotation isn’t set up or in some DOS attacks).

Coldfusion

Changing the coldfusion logs location is the easiest of all.

  1. Open your browser and navigate to your CF administrator. Usually it will me something like http://localhost:8300/CFIDE/Administrator.
  2. In the menu, under Debugging & Logging click on Logging Settings
  3. Edit the log file system path and submit changes.
  4. Restart your coldfusion server.

JRun Event Logs

You can modify the event log location by editing your server’s jrun.xml. Open that file and do a search for “jrunx.logger.LoggerService”.

You’ll want to edit the “<attribute name=”filename”>{jrun.rootdir}/logs/{jrun.server.name}-event.log</attribute>” line.

I’ve run into an issue with setting this path to a different drive than the one your JRun administrator is running from. Will update this post of it find a solution.

More JRun4 logging info can be found at: http://livedocs.adobe.com/jrun/4/JRun_Administrators_Guide/logging4.htm

JRun stdout and stderr Logs

The out and err log locations are more difficult to modify since you’ve got to edit the Windows registry. You Penguin heads out there should see the Adobe Tech Note at http://helpx.adobe.com/legacy/kb/jrun-4-0-configuring-java.html.

  1. Open regedit (Start > search regedit)
  2. Backup your registry via File > Export from the regedit console
  3. Navigate the registry to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
  4. Look for your JRun server’s name and edit (right-click > Modify) SystemError and SystemOut. Set the file system path you wish, e.g. E:\JRun\{jrun.server.name}\{jrun.server.name}-err.log
  5. Go to your Windows Services and restart the JRun server service.