This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Enable logging in script


I am trying to enable logging to a file from a script.  From the script window I can type:

 

     enableLog("H:/ti_regress/logscript.txt");

 

and logging successfully begins.  However, I then try to set up a regression script called "sanity" that begins:

 

                       function sanity(){
                                 enableLog("H:/ti_regress/logscript.txt");

                      }

 

I get the error:


js:> sanity
ReferenceError: "enableLog" is not defined. (D:\dev_src\netra\script\ldrn_evm.js#156)

Is there some syntax I am missing to incorporate the command into my script?
  • Hi,

    You may want to take a look at the example scripts installed with CCS. They are typically located at:

    <CCS_INSTALL_DIR>\ccsv4\scripting\examples\DebugServerExamples

    For example, check the file <Breakpoints.js> that enables logging at the beginning of its execution:

    Breakpoints.js said:

    ...

    // Create a log file in the current directory to log script execution

    script.traceBegin("BreakpointsTestLog.xml", "DefaultStylesheet.xsl")

    // Set our TimeOut

    script.setScriptTimeout(15000)

    // Log everything

    script.traceSetConsoleLevel(TraceLevel.ALL)

    script.traceSetFileLevel(TraceLevel.ALL)

    ...

    Hope this helps,

    Rafael

  • 'enableLog' is for logging from the Scripting Console. For script logging, use the method Rafael suggested

    Thanks

    ki

     

  • I wish to record only output from the Scripting Console, so the other method records many things but not the script view output.  The enableLog works fine except when it is incorporated into a script, when it then does not work.  I have got around this by using the enableLog directly from the scripting console, followed by my command to the scripting file.  Ideally I would still like to incorporate the enableLog command into my script file.

  • Jane - enableLog is strictly a Scripting Console command. It can not be called from a DSS script. Your workaround is the correct use case.

    Thanks

    ki