【问题标题】:How to detect Line Debugging in on & the debugger is running?如何检测在线调试和调试器正在运行?
【发布时间】:2017-11-06 20:05:21
【问题描述】:

我们有一个 ColdFusion 8 应用程序在 Windows Server 2003 上的 JRun4 中运行。

我们如何检测(并显示)调试器是否在 CF Administrator 中启用允许线路调试运行。检测后,我们希望在调试器正在运行的应用程序上显示警告。

【问题讨论】:

  • 您为什么要这样做?您是否打算在生产中打开分步调试?如果是这样,这是一个非常糟糕的主意。分步调试确实应该在本地开发环境中使用。
  • 这是TEST环境;其他开发人员即使在完成调试后仍保持打开状态。这将仅用于显示警告,因此有人将其关闭。
  • 在共享环境中运行步调试不是一个好主意。
  • 我完全同意这一点,但这超出了我的薪酬等级,但这仍然有助于让 下一个 开发人员关闭调试器。
  • 明白。我什么也说不出来。

标签: debugging coldfusion jrun


【解决方案1】:

您应该能够为此使用 ColdFusion 管理员 API。当然,您需要安全/权限才能使用它。如果您使用沙盒安全性,请启用对 cf_web_root/CFIDE/adminapi 目录的访问以使用管理员 API。基本上,管理员 API 可以让您以编程方式访问大部分 ColdFusion 管理员设置。

From the documentation:

您可以使用管理员 API 以编程方式执行大多数 ColdFusion 管理员任务。管理员 API 由一组 ColdFusion 组件 (CFC) 组成,其中包含您调用以执行管理员任务的方法。

用于管理调试设置的 CFC 是 debugging.cfc

这是一些伪代码(尚未测试):

<cfscript> 

// Instantiate the administrator.cfc 
adminObj = createObject("component","cfide.adminapi.administrator");

// Call the administrator.cfc login method, passing the ColdFusion Administrator password
adminObj.login("#password#","#username#");

// Instantiate the debugging CFC
debugObj = createObject("component","cfide.adminapi.debugging");

// Call the desired CFC method
if (debugObj.isLineDebuggerEnabled()) {

    if (debugObj.isLineDebuggerRunning()) {

        // Stop line debugger
        debugObj.stopLineDebugger();
    }

    // Disable the line debugger
    debugObj.setLineDebuggerEnabled(enabled="false");
}

</cfscript>

这应该让你开始。 Here is some documentation on the debugging.cfc and it's methods.

Manages debug settings.

hierarchy:  WEB-INF.cftags.component
            CFIDE.adminapi.base
            CFIDE.adminapi.debugging
path:   {web-root}\CFIDE\adminapi\debugging.cfc
serializable:   Yes
properties: 
methods:  addDebugEvent,
          deleteIP,
          getCurrentIP,
          getDebugProperty,
          getDebugRecordset,
          getIPList,
          getLineDebuggerPort,
          getLogProperty,
          getMaxDebuggingSessions,
          isLineDebuggerEnabled,
          isLineDebuggerRunning,
          restartLineDebugger,
          setDebugProperty,
          setIP,
          setLineDebuggerEnabled,
          setLineDebuggerPort,
          setLogProperty,
          setMaxDebuggingSessions,
          startLineDebugger,
          stopLineDebugger,
          validateIP*
inherited methods:  dump,
                    getEdition,
                    getInstallType,
                    getJRunRootDir,
                    isAdminUser,
                    RDSInvoker,
                    setJrunSN

【讨论】:

  • 这正是我想要的
猜你喜欢
  • 2018-04-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多