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?

  • Hi Gary,

    For debugging you need Visual Studio, look for the System Debugger in the documentation. For just script testing (observing the output) you can use the scrip tester functionality in Designer. For custom script development in the Synchronization Editor or debugging of processes etc. from the Object Browser you need Visual Studio. It is a worthwhile investment for a larger company and you could also use the community edition if your company is smaller than 5 developers (don't take that to the bank but verify).

    Regards,

    Rodney

  • 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