How can i trace the script on IDM

I want to do trace both for system script and custom script, may i know how I can achieve this?

Is there any debugger available?

Parents
  • Hi Gary,

    regarding debugging

    Rodney's hints are good.

    It feels dirty but I'll share that hint anyway. When you write scripts in Designer (and I hope SyncEditor) you can use MsgBox to show the value of variables. Better than nothing but not much :-P

    Reagarding logging and tracing

    For simple logs, you might be able to use VID_Write2Log(ByVal LogFile As String, ByVal Line As String)

    For enhanced logging You can use NLog (No need of dll import).

    Script Example:

    ' VB
    Dim logger = NLog.LogManager.GetLogger("My_Logger_Name")
    logger.Trace("TraceMessage")
    logger.Info("InfoMessage")
    
    // C#
    var logger = NLog.LogManager.GetLogger("My_Logger_Name");
    logger.Trace("TraceMessage");
    logger.Info("InfoMessage");

    GlobalLog.config:

    Inside the globallog.conf you can configure nlog.

    I like to separate the loggers into different files. Here is an Example:

    <nlog autoReload="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    	...
    	<targets>
    	    ...	
    	    <target name="customlog" xsi:type="File" fileName="C:\Logs\custom_log\${logger}.log" layout="${layout}" encoding="utf-8" />
    		<target name="customdebug" xsi:type="File" fileName="C:\Logs\custom_log\debug\${logger}.log" layout="${layout}" encoding="utf-8" />
            ...
    	</targets>
    
    	<rules>
            ...
    		<logger name="CCC*" minlevel="Info" writeTo="customlog"/>
    		<logger name="CCC*" minlevel="Debug" writeTo="customdebug"/>
            ...
    	</rules>
        ...
    </nlog>

    I think you can find some technical documentation anbd KB article about logging with OIM.

    If you want to persist and disribute Your logconfi. OIM documentation about the SoftwareLoader schould be interesting too.

    And the nlog documentation might also help.

    https://github.com/nlog/nlog/wiki/Configuration-file

    Thomas

Reply
  • Hi Gary,

    regarding debugging

    Rodney's hints are good.

    It feels dirty but I'll share that hint anyway. When you write scripts in Designer (and I hope SyncEditor) you can use MsgBox to show the value of variables. Better than nothing but not much :-P

    Reagarding logging and tracing

    For simple logs, you might be able to use VID_Write2Log(ByVal LogFile As String, ByVal Line As String)

    For enhanced logging You can use NLog (No need of dll import).

    Script Example:

    ' VB
    Dim logger = NLog.LogManager.GetLogger("My_Logger_Name")
    logger.Trace("TraceMessage")
    logger.Info("InfoMessage")
    
    // C#
    var logger = NLog.LogManager.GetLogger("My_Logger_Name");
    logger.Trace("TraceMessage");
    logger.Info("InfoMessage");

    GlobalLog.config:

    Inside the globallog.conf you can configure nlog.

    I like to separate the loggers into different files. Here is an Example:

    <nlog autoReload="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    	...
    	<targets>
    	    ...	
    	    <target name="customlog" xsi:type="File" fileName="C:\Logs\custom_log\${logger}.log" layout="${layout}" encoding="utf-8" />
    		<target name="customdebug" xsi:type="File" fileName="C:\Logs\custom_log\debug\${logger}.log" layout="${layout}" encoding="utf-8" />
            ...
    	</targets>
    
    	<rules>
            ...
    		<logger name="CCC*" minlevel="Info" writeTo="customlog"/>
    		<logger name="CCC*" minlevel="Debug" writeTo="customdebug"/>
            ...
    	</rules>
        ...
    </nlog>

    I think you can find some technical documentation anbd KB article about logging with OIM.

    If you want to persist and disribute Your logconfi. OIM documentation about the SoftwareLoader schould be interesting too.

    And the nlog documentation might also help.

    https://github.com/nlog/nlog/wiki/Configuration-file

    Thomas

Children
No Data