Welcome Guest! Log in
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…

This article shows how to add log messages from a process to the Runtime's log files, console and log database.

Our sample process

You can download the sample process here :    archive processWithUserLog (1 KB)

It does nothing special except logging messages.





Here is a description of the process, step by step. Have a close look to each "Meta-inf" property of the different actions.

  • START (EmptyAction) : does nothing, but logs the "START of processWithUserLog" message. See how we used the ${/CORE_SESSION_NAME}$ variable.
  • Sleep : this one logs two messages : pay attention to the trigger attribute which can be "beforeExecution" and "afterExecution".
  • Scripting : the script sets the ~/param parameter to "newvalue". The actions logs two messages : one beforeExecution and one afterExecution. This can be usefull when we want to "watch" a variable before / after an action.
  • subprocess/EmptyAction : logs three messages at different levels - see the path attribute.
  • END : logs the "End of processWithUserLog" message.

This is the "Meta-Inf" property for the "Sleep" action:

<userLog path="../START/SleepInfo" trigger="beforeExecution">
    <info>Before Sleep</info>


Result on the Runtime console

28/10/2014 17:44:57,338 - processWithUserLog (c0a84bc5014957a56459674d16d1ffbd) is started
28/10/2014 17:44:57,344 - START of processWithUserLog
28/10/2014 17:44:57,360 - Before Sleep
28/10/2014 17:44:58,363 - After Sleep
28/10/2014 17:44:58,368 - Before Scripting: param=value1
28/10/2014 17:44:58,385 - After Scripting: param=newvalue
28/10/2014 17:44:58,391 - Before processWithUserLog/subprocess/EmptyAction/EmptyAction - 1
28/10/2014 17:44:58,392 - Before processWithUserLog/subprocess/EmptyAction/EmptyAction - 2
28/10/2014 17:44:58,394 - Before processWithUserLog/subprocess/EmptyAction/EmptyAction - 3
28/10/2014 17:44:58,405 - END of processWithUserLog
28/10/2014 17:44:58,412 - processWithUserLog (c0a84bc5014957a56459674d16d1ffbd) is ended


Result in Analytics

The messages that appear in analytics are the ones that use the "stambiaLog" logger.

For each message:

  • the "Name" column is set with the Meta-Inf's "path" attribute value,
  • the "Message" column is set with the Meta-Inf's "info" element content.



Note : in our example, most messages are logged explicitly under the "START" action, thanks to the "path" attribute. This provides to Analytics Users a single entry point to read messages, which can be helpful.


Things to remember

It is possible to log information into the Runtime's log files and log database, using the Meta-Inf properties of your process' actions.

You can declare several userLog elements within the same action.

Each <userLog/> element has the following properties :

  • "path" attribute: the Name of the message (and optionnally the path to the process step it should be attached to) - usefull in analytics
  • "trigger" attribute: when the message should be logged, beforeExecution or afterExecution of the action
  • "info" element: defines the message content
  • "logger" element(s): specifies which logger will receive the message - by default you can use:
    • userConsole: logs into the Runtime's standard output
    • mainConsole: same as userConsole, prefixed with date/time
    • stambiaLog: logs into the Runtime's log database

Note: the first two loggers are declared in the "properties/log4j.xml" file and they can be personalized. You can also add your own loggers. For more information, check out http://logging.apache.org/log4j/1.2/.


Here is a sample userLog Meta-Inf :

<userLog path="../START/ScriptingWatcher" trigger="beforeExecution">
<info>Before Scripting: param=${~/param}$</info>
<userLog path="../START/ScriptingWatcher" trigger="afterExecution">
<info>After Scripting: param=${~/param}$</info>



Suggest a new Article!