I store the CF instance name and the machine name in the server.os
scope and then just refrence that in my error.

                <!--- Instance Name --->
                <cfif NOT IsDefined("Server.OS.InstanceName")>
                        <!--- Set the J2EE Server type [JLB]--->
                        <cfset Variables.J2EEServer = "JRUN">
                        <!--- Set the instance name based on the J2EE Server 
type [JLB]--->
                        <cfswitch expression="#Variables.J2EEServer#">
                                <cfcase value="JRUN">
                                        <cfobject action="create" type="java" 
class="jrunx.kernel.JRun"
name="Variables.objRun">
                                        <cfset Server.OS.InstanceName = 
Variables.objRun.getServerName()>       
                                </cfcase>
                        </cfswitch>
                </cfif>
                
                <!--- Machine Name --->
                <cfif NOT IsDefined("Server.OS.MachineName")>
                        <!--- Set the environment based on the machine name --->
                        <cfset variables.obj.inet               = 
createObject("JAVA","java.net.InetAddress")>
                        <cfset Server.OS.MachineName    =
UCASE(ListFirst(variables.obj.inet.getLocalHost(),"/"))>
                </cfif>

On 4/23/07, Nathan Strutz <[EMAIL PROTECTED]> wrote:
> AJ,
> that's very cool - i am using this:
>
> createObject("java","java.net.InetAddress").getLocalHost().toString()
>
> which outputs the server name and IP address, but the JRun method could be
> better, depending on your server setup.
>
> --
> nathan strutz
> http://www.dopefly.com/
>
>
> On 4/23/07, AJ Mercer <[EMAIL PROTECTED]> wrote:
> >
> > take a look at this
> > <cfobject action="create" type="java" class="jrunx.kernel.JRun" name="jr"
> > />
> > <cfoutput>#jr.getServerName()#</cfoutput>
> >
> > The cool thing about this is if you have multiple instances on one server
> > -
> > it returns the instance name.
> >
> > Also works for CF Standard.
> >
> > On 4/23/07, Peterson, Chris <[EMAIL PROTECTED]> wrote:
> > >
> > > We have a cluster, and I have errors setup to email to me.  Here is the
> > > code I am going to stick into onApplicationStart to get a unique value
> > > for each server:
> > >
> > >
> > > <!---// If a server.server_name value is not defined, go get it from
> > > c:\name.txt //--->
> > > <cflock scope="server" timeout="3">
> > >         <cfif not structKeyExists(server, "server_Name")>
> > >                 <cftry>
> > >                         <cffile action="read" file="c:\name.txt"
> > > variable="tmp_name">
> > >                         <cfset server.server_name = trim(tmp_name) />
> > >                         <cfcatch type="any">
> > >                                 <cfset server.server_name = 'Unknown
> > > Server' />
> > >                         </cfcatch>
> > >                 </cftry>
> > >         </cfif>
> > > </cflock>
> > >
> > > I have a file in the c:\ of each server with its name, so If I get tons
> > > of errors or machine specific errors, I know right where to go.  Is my
> > > lock setup properly, or does anyone else address this problem a
> > > different way?
> > >
> > > Chris
> > >
> > >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276081
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to