在ColdFusion中,是否有一种方法来确定代码正在运行什么服务器? [英] In ColdFusion, is there a way to determine what server the code is running on?

查看:151
本文介绍了在ColdFusion中,是否有一种方法来确定代码正在运行什么服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ColdFusion代码中有什么方法来确定代码在什么服务器上执行吗?我有几个负载平衡的ColdFusion服务器。我想知道在捕获异常时代码在哪个服务器上运行,因此我可以在日志记录/报告代码中包含该信息。

Is there any way in ColdFusion code to determine on what server the code is executing? I have few load-balanced ColdFusion servers. I want to be able to know on which server the code is running when I catch an exception, so I can include that information in the logging / reporting code.

服务器是Windows 2003 / IIS,如果这很重要。我很想知道如何在Linux / Apache中做。 : - )

The servers are Windows 2003/IIS, if that matters. I'd love to know how to do it in Linux/Apache too. :-)

推荐答案

这可能会进一步...

This may help you further...

<cfscript>
machineName = createObject("java", "java.net.InetAddress").localhost.getCanonicalHostName();
hostaddress = createObject("java", "java.net.InetAddress").localhost.getHostAddress();
</cfscript>
<cfdump var="#machineName#"><br />
<cfdump var="#hostaddress#"><br />

这篇关于在ColdFusion中,是否有一种方法来确定代码正在运行什么服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆