Where am I?

ColdFusion , IIS , Web Servers Add comments

If you run load-balanced ColdFusion servers, it can often to difficult to determine which server a notification or error message originated from.  There's a nice little Java trick to get around this. 

---
#Createobject('java','java.net.InetAddress').getLocalHost().getHostName()#
--- 

We add this line to error notifications on our site so that we always know which physical machine the message came from.   This makes it a little easier to diagnose a problem, determine if it is limited to one server, and know which log files to look at. 

This is also great if your site is responding a bit slow and you want to know which server in the setup you are hitting from your machine.  We set up a small script called whereami.cfm that simply displays the machine name. 

1 response to “Where am I?”

  1. Gorav Says:
    I often read your blog and always find it very interesting. Thought it was about time i let you know…Keep up the great work

Leave a Reply

Leave this field empty:



Powered by Mango Blog. Design and Icons by N.Design Studio