JinnIde - Loq4Jinni

JinnIde is the Jinni Prolog IDE Plugin for JEdit. It includes an automated logger system similar in some aspects to Log4J which is thus analogously called Loq4Jinni (with the "q" standing for Quality ;). However, unlike Log4J, it is still rather simple. But, like Log4J, it is already very effectively usable and it has been successfully applied throughout the implementation of JinniDoc and other Jinni Prolog projects.

You can use it in your programs e.g. by writing

loq:print(info, 'write sth.')

which prints 'write sth.' if the current logging level actually is info or

loq:println(error, 'write sth. with automatic carriage return')

which prints 'write sth. with automatic carriage return' including -as it says- a trailing newline when the current logging level actually is error. Note that there is not yet a GUI-based implementation so everything has to be done within the command line of JinnIde.

Module structure

Loq4Jinni is currently made of the following three modules:

The following levels are currently supported:

If the GUI is not used, the user may also edit loqProps directly by modifying the level set by setLoqActivity e.g. from setLoqActivity(error) to setLoqActivity(info), which switches the logger's level from error to info. Note that above levels are in a hierarchy which means that if one sets the level to error all the log statements that specify warn or info as levels will also get printed.

So one of the basic features of this logger allows switching the logging centrally without having to resort to switching on and off the stuff in every rsp. logging place. That is, you renew the "property file" called loqProps which, for instance, is set to logActivity(none). In this case all the logging is completely switched off. For Loq4Jinni to work as desired one needs to configure it as explained in the following.

Configuration

Note: this is not needed anymore ! See the advanced features. Anyway, the following explains an alternative for those who prefer to type instead of point and click.

Thanks to separating the database part of loq into another Jinni Prolog file (loqProps) the amount of setup effort is significantly minimal:

Of course, when one is already comfortable with the current logging level (and the current exception list) then no configuration is needed and Loq4Jinni can be applied at once.

Like Log4J, existing classes, modules or programs that contain loq statements need not be recompiled.

Exception lists

As a simple and effective extension to the level hierarchy, Loq4Jinni also offers the possibility to specify levels whose log statements are ignored even if contained in a hierarchy. This is easily done by using the setExceptionList predicate of loqProps. For instance, if setExceptionList([info]) is set, all loq statements using the info level are suppressed despite setActivityLevel being set to info or error.

File output

Loq4Jinni also offers streaming its log to whatever file and location one provides (of course, only if it exists and if it is writable). This feature is indispensable whenever Jinni Prolog is applied in the realm of web or J2EE applications because it is otherwise practically impossible to produce a configurable log the way it is provided by Log4Java or, as a matter of fact, by Loq4Jinni.

Further hints

Loq4Jinni has been documented with JinniDoc, so see its API for further hints.


© 2001-2014 Chico Töpfer