list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / Université d'Ottawa

User Manual    [Previous]   [Next]   

Tracers

MOTL sets the Console to be its default tracer. However, it provides a set of potential tracers that will have an impact on how tracing is injected and how its collected. Modellers can control the model tracer using a tracer directive.

MOTL tracers can be classified into two main categories: Built in tracers and third party tracers. The main difference between these two categories is that the first category of tracers doesn’t require any additional jars imported into your model generated code, while the later requires jars specific to each tracer.

  1. (Built in tracers)
    • Console: trace output will be directed to system error.
    • File: trace output will be directed to trace log file.
    • Java Native Logging: Java provides a logging API implemented in its platform. MOTL provides the capability of injecting trace code using Java native logging API.
     
  2. (Third party tracers)
    • log4j: a well known java tracer. In MOTL, if log4j is selected as a tracer, log4j trace points will be in injected. In addition, an xml file (log4j2.xml) configuration file will be generated.
    • Linux Trace Toolkit Next Generation (LTTNG): Lttng is a well known tracer that allows kernel and userspace tracing. It targets C/C++ programs, however, tracing of Java programs using Lttng is possible through Java Native Interface (JNI). To execute Java programs instrumented with lttng trace points, (liblttng-ust-java.jar) is required.

File tracer

// this example generates traces using the
// File tracer

tracer File;

@SuppressWarnings("deprecation")
class Student
{
  Integer id;
  trace id;
}

// The suppressWarnings annotation allows this example
// to keep working as of Java 19 as per Umple issue £2018

      

Load the above code into UmpleOnline

 

Java native logging API

// this example generates traces using the Java
// native logging API
tracer JavaAPI;

@SuppressWarnings("deprecation")
class Student
{
  Integer id;
  name;
  // trace id with default logging level info
  trace id;
  // trace name to logging level severe
  trace name logLevel severe;
}
      

Load the above code into UmpleOnline

 

Lttng tracer

// this example generates tracespoints using
// the Lttng tracer
tracer Lttng;

class Student
{
  Integer id;
  trace id;
}

      

Load the above code into UmpleOnline

 

log4j tracer with default log4j xml configuration file

// this example generates traces using the
// log4j tracer
// Default log4j xml configuration file is
// generated (log4j2.xml) 
tracer log4j;

class Student
{
  Integer id;
  name;
  
  // trace attribute id with log4j level set to (info)
  trace id logLevel info;

  // trace attribute id with log4j level set to (error)
  trace name logLevel error;
}

      

Load the above code into UmpleOnline

 

log4j tracer with customized log4j xml configuration file


// this example generates traces using the
// log4j tracer
//
// Customized log4j xml configuration file
// is generated (log4j2.xml)
//
// Root logger level will be debug
//
// Info logging level will be written into
// console output
//
// Error logging level will be written into file
tracer log4j root=debug info = console error = file;

class Student
{
  Integer id;
  name;
  
  // trace attribute id with log4j level set to (info)
  trace id logLevel info;

  // trace attribute id with log4j level set to (error)
  trace name logLevel error;
}

      

Load the above code into UmpleOnline

 

Syntax