本文介紹了在 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 中,有沒有辦法確定代碼在哪個服務器上運行?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!