Plugin log

When creating complex plugins, it is often useful to have the plugin generate a specific log file during generation. This not only helps for debugging purpose but also helps when supporting the plugin.

Setting up the logfile

A log can be created by Plugin. It is a rolling log meaning that a new log with a new numbered extension will be create each time the plugin is run. The name of the logfile is set by the plugin developper, together with a default level of logging.

This settings are available from the Runtime tab of the plugin descriptor, as shown below:


Logging to the logfile

Once the logfile has been set up. Messages can be sent to the log from either the Java code of the plugin or from Velocity templates using the following syntax:

  1. From Java: PluginLog.logError(String msg, Throwable e) can be used throughout the plugin code.
  2. From Velocity: $pluginLog.logError("my message").

Multiple log levels are available: Error, Warning, Info, Debug, Trace. Each of these levels can be accessed through a variation on the 'logXXX' method described above.

Controlling the log during generation

Users of the plugin (i.e. once the plugin has been deployed) can control the level of logging for a specific plugin. The developper of a plugin can control the default level (see setting above), but the user can increase/decrease that as a property on the plugin. See plugin properties in the tigerstripe.xml project generation details.


© copyright 2005, 2006, 2007 Cisco Systems, Inc. - All rights reserved