Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page describes the logging, tracing, and timing features of Tuscany. These features can be used to debug problems witht with the Tuscany runtime, understand code flow, and provide timing metrics for timing for competitive analysis or salesperformance claims.

Java Logging versus Aspect Oriented Programming (AOP) Approach

There are type types of logging embeded in the Tuscany runtime: explicit and implicit. The explicit logging is implimented by the Java 2 SE core logging facilities such as java.util.logging.Logger. This is the logging that many Java programmers are familiar with, and the logging requires calls to the Logger programming interface. Throughout the Tuscany code base you see call to this facility such as this call in Tuscany org.apache.tuscany.sca.node.launcher.NodeLauncher.

Code Block
titleJava Logging in Tuscany
borderStylesolid

        logger.info("Apache Tuscany SCA Node is starting...");

Calls to this facility by default go to the standard output of the program. This is the typical result that one sees in the console:

Code Block
titleJava Logging Output
borderStylesolid

INFO: Apache Tuscany SCA Node is starting...

The Java SE core logging works well as a general purpose logger and gives a general idea of the important phases in the Tuscany runtime. However, one drawback is that this logging system only publishes predetermined messages created by the developers. If you wish to change the logging points, you must change the Tuscany source code, build, and run again with your private code base.

Another logging and tracing facility is available in Tuscany that gives the user a bit of flexibility in what gets logged, and requires no source code modifications to run. This is an Aspect Oriented Programming (AOP) approach that runs via a Java agent at runtime. Just like a debugger can start and stop and inspect a Tuscany Java program, so too can an AOP agent inspect and report on a Tuscany Java program. Tuscany employs the AspectJ implementation, and its runtime agent is contained in the aspectjweaver.jar file. The AOP agent is specified from a command line option or runtime options:

Code Block
titleJava AOP Agent
borderStylesolid

java -javaagent:"<path to aspectjweaver.jar>" calculator.CalculatorClient

Full documentation on AspectJ is available at the AspectJ web site. Tuscany provides example usage in the module tracing-aspectj in the build tree and the released code.

Brief Apect Oriented Programming Introduction

Logging and Tracing in Tuscany

Timing

Standalone Runtime Example

...