Servoy Plugins
 
Home
Factfinder-Plugin
XML-Plugin
DialogPro-Plugin
MailPro-Plugin
TrayIcon-Plugin
PDI-Plugin
Table-Bean
DateUtils-Plugin
Log-Plugin
ScreenShot-Plugin
Slider-Bean
Shop
Downloads
Company
Partnerships
Contact
 

Log-Plugin for Servoy

Free plugin to allow easy logging of methods

The Log-Plugin for Servoy wraps the power of log4j in a simple Servoy plugin. Developers can easily add comments to their code that will be outputted to the console (or a client trace file), a log file or the Servoy server's log.

What gets written to the log depends on the priority the developer gave to the message. These priorities are available:

TRACE plugins.Log.trace(aMessage)
DEBUG plugins.Log.debug(aMessage)
INFO plugins.Log.info(aMessage)
WARN Plugins.Log.warn(aMessage)
ERROR Plugins.Log.error(aMessage)
FATAL Plugins.Log.fatal(aMessage)
 
 
The level that is outputted can be set at runtime. If the plugin is set to plugins.Log.debugLevel("WARN"), only messages of priority WARN, ERROR and FATAL will be outputted.

Most developers use application.output(aMessage) during development and comment those out during deployment. With the Log-Plugin these messages can remain in the code for later debugging. By setting the priority to ERROR for exampe during deployment, debugging output can be prevented but still be accessible.

The plugin supports i18n messages, allows configuration of how messages are outputted, can output to the status area and display status area warning messages (shown in red).

Here is a short sample code that demonstrates the functionality:

// Set the Level from which on messages are outputted
plugins.Log.debugLevel = 'INFO';

// Create a log file to enable logging to a file
plugins.Log.logFilePath = 'C:\\test.log';

// Set the pattern in which messages are outputted
plugins.Log.outputPattern = '%s %p %d{HH:mm:ss.S}: %m%n';

// Output some messages
plugins.Log.trace('This is a trace message'); // Will not be outputted if debugLevel is 'INFO'
plugins.Log.debug('This is a debug message'); // Will not be outputted if debugLevel is 'INFO'
plugins.Log.info('This is a info message');
plugins.Log.warn('This is a warn message');
plugins.Log.error('This is a error message');
plugins.Log.fatal('This is a fatal message');

The output could look like this (depending on the outputPattern):

yourSolution 14:00:00.000 DEBUG: creating 100 records took 4375ms

Important notice: from version 1.5.1 on you need to register the plugin using a (free) license key.

The Log-Plugin is free, but requires registration. A free license key can be obtained from the shop in the Log-Plugin section by hitting the "GET IT" button and filling out the registration form. For a full list of changes for each version see the version history.