In ColdFusion, is there a way to determine what server the code is running on?(在 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 中,有没有办法确定代码在哪个服务器上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 ColdFusion 中,有没有办法确定代码在哪个服务
基础教程推荐
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Struts2 URL 无法访问 2022-01-01
