*
Metamerge logo
Search

Advanced Search
*
*
*
* HOME DOCUMENTS & RESOURCES DOWNLOADS EARLY TECH ACCESS SUPPORT FAQ KNOWN ISSUES OLD VERSIONS
*

 

Logging and Debugging

Logging and debugging is mainly done through the Task object.  A log file will show up in your Metamerge install directory in the logs subdirectory:  Each run will create a new log file bearing the name of your Assemblylines and a run number.

 

Logging

Key data is logged from the Metamerge Integrator engine, from its components (Connectors, Parsers, etc.) as well as from user's scripts. Note that almost every Connector has a parameter called "Debug Mode" - it can be used to turn on and off the Connector's output to the log file.

Dumping to the log file is done through the task object. Dumping to the console (the console window associated with AssemblyLine execution) and the system log  (see command line options for the Server) is done through the main object.

Below are some examples of what the user can dump and sample code in JavaScript that performs these operations. All examples show how to dump to the log file using the logmsg method. However all you have to do in order to dump to the console window is to change the task keyword to main .

1. Dumping the content of an Entry object.

        task.dumpEntry(entry)

        / "main.dump(entry)"  will dump the entry to the console /

2. Dumping the content of an Attribute:
    2.1. Dumping single value Attribute:

        Suppose attr (with name Attr1) is the single value attribute you wish to dump. You can create your own attribute and set a value to it with the following 2 lines of code:

    var attr = system.newAttribute("Attr1");
    attr.addValue("Value1");

        - the dumping itself:
        task.logmsg("Dumping single value attribute:" + attr.getName());
        task.logmsg("Value = " + attr.getValue());

    2.2. Dumping multiple values Attribute:

        Suppose attr (with name Attr1) is multiple values attribute you wish to dump. You can create your own attribute and set some values to it with the following 3 lines of code:

    var attr = system.newAttribute("Attr1");
    attr.addValue("Value1");
    attr.addValue("Value2");

        - the dumping itself:
        var values = attr.getValues();
        task.logmsg ("Dumping multiple values Attribute:" + attr.getName());
        for (i=0; i<values.length; i++)
        {
            task.logmsg("Value " + i + " --> " + values[i]);
        }
  
        Hint:  If you don't know a priory whether the attribute is single or multiple values you can use the multiple values pattern - it works even when your attribute is single value.

3. Dumping the state of a Connector:

    You can at any time, dump the state of any of the Connectors involved in your integration process. The sample code bellow gives you (dumps) all the information available for a particular Connector - Conn. Of course, according to your needs you can dump arbitrary subset of the Connector's parameters listed below.

    var status = Conn.getStats();
    task.logmsg("Dumping Conn status:");

    task.logmsg("Number of add operations performed: " + status.numAdd());
    task.logmsg("Number of delete operations performed: " + status.numDelete());
    task.logmsg("Number of errors: " + status.numErrors());
    task.logmsg("Number of get operations performed: " +  status.numGet());
    task.logmsg("Number of entries ignored: " + status.numIgnored());
    task.logmsg("Number of lookup operations performed: " + status.numLookup());
    task.logmsg("Number of modify operations performed: " + status.numModify());
    task.logmsg("Number of no-change entries: " + status.numNoChange());
    task.logmsg("Number of entries skipped: " + status.numSkipped());

4. Dumping arbitrary log messages:

    We won't surprise you telling you that with the logmsg function you can log any text you want. This means you can indicate (to the log file or to the console) any state of the custom logic of your AssemblyLines.

    task.logmsg("Type here the message you want to dump");

Example

    Package containing ready to run configuration that demonstrates all the logging described above is included here

 

 Debugging

    A debug mechanism can enable messages and breakpoints when debugging is turned on.  This is documented here.

Example

    Package containing ready to run configuration that demonstrates how to dump to and interact with the debugging console is included here

 

 

*
  Metamerge Integrator version 4.5 ©Copyright Metamerge AS 2000-2002 Last edited 2002-04-30 contact us