The LogAgent can be used by adding the LogAgent as javaagent to the java command line.
The simplest form is by adding
It is possible to add several parameters to the logagent in order to modify its behaviour:
It is possible to specify that the output has to be logged to the file otherfile.txt by using the output command
It is possible to specify the package or class to be logged on the command line as well, in that case
the include command can be used. Specifying
The same way specific packages
can be excluded as well using the exclude command.
Specific methods can be excluded using the exmethod command.
Finally it is possible to specify an configuration file containing a full replacement configuration:
Using the config command an alternative base configuration is selected. The
The configuration file for the LogAgent can be used to specify what has to be logged, and what doesn't have to be logged. In the configuration file the following items can be used:
Every command has to be on its own line. Comments in the file should be on separate lines that start with #.
When writing an own config file you have to keep in mind that the most specific match wins. If the package foo is excluded, and the package foo.bar is included (and no other packages within foo are excluded or included) the methods of class foo.bar.meetoo.SomeClass will have logging added, while the classes in foo.somewhatelse.SomeOtherClass will not be logged.
In case the configuration file does not contain an output command, and the output command is also not specified on the command line, no output will be produced, unless the java logging configuration has some logging action for the logagent logger. (Currently everything is logged at the FINER level.)
The default configuration
# default configuration exclude java exclude javax exclude net/famkruithof/logagent exclude sun exclude org/apache/bcel exclude com/sun exclude org/ietf/jgss exclude org/omg exclude org/w3c/dom exclude org/xml/sax exclude org/omg/CORBA_2_3 output logagent.xml
Please note that logging inserted by the logagent is disabled while logging inserted by the logging agent is being executed to prevent logging loops. Furthermore it may not be possible to add logging during runtime to classes needed by the logagent itself, this because the classes are loaded before the logagent is active. Currently the LogAgent can only add logging to classes that have not been loaded before the logagent is active and classes that are not needed by the logagent to perform its function.
NotesNote that in order to use the logagent, the bcel-5.2.jar file should be available in the same directory as the logagent. If you have improvements, contact information on the homepage of this host.
An UUID generator on the web
The uptime of home.famkruithof.net