OpenWGA 7.2 - TMLScript reference

TMLContext "this"
Property :

log

On object TMLContext "this"
Usage Provides an object for logging output to the application log
Description The object provided is a Java object "Logger" of the logger library "Log4J" by the Apache Foundation. A complete documentation of the object therefor can be found in the Apache Log4J API Dokumentation.

It provides five methods to log messages in different log levels:
  • log.debug(message [, javaException])
  • log.info(message [, javaException])
  • log.warn(message [, javaException])
  • log.error(message [, javaException])
  • log.fatal(message [, javaException])
The optional "javaException" parameter does not accept JavaScript exceptions.

For conveniently logging of normal messages in TMLScript you may want to use the Console object instead. For logging errors and Java exceptions method WGA,.logException() is suitable.
Return value Logger object (Java object org.apache.log4j.Logger)
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Examples

Some usages of the log object:

this.log.error( "Critical Error in TMLScript, calculation aborted!" );
this.log.warn( "Current value for field xx too high,!" );
this.log.info( "UserSessions: " + this.profile.meta("LASTSESSIONHITS") );
this.log.debug( "Successfully attached file" );