Targets

Most of the java logging framework use a level that defines the threshold for a logger. Every log request that is beneath this level will not be processed. This is not a common approach when you look at other systems like the Linux system logger or many other. Somehow this level approach got invented into java and is a standard. There are quite a few good reasons why other logging systems does not use this approach. jLo brings a new approach to java logging frameworks. Like the other system jLo uses targets. These targets does not define a threshold and there is not particular order of these targets. You can switch on and off every target. It is like a bitset where certain bits are set and if the target of a log request matches one of the bits that are set it will be processed.
The following targets are currently supported:
trace, info, debug, warn, error, fatal
There are two special targets:
off, all
These will either switch off all or switch on all targets.

Examples:

<logger name="org.jzonic.jlo">    
  <targets>ALL</targets>
  <generator-name>TestGenerator</generator-name>
</logger> 

This logger has all targets on.

<logger name="org.jzonic.jlo">    
  <targets>ERROR,FATAL</targets>
  <generator-name>TestGenerator</generator-name>
</logger> 

This one will only log request with the targets error and fatal.

You can use the ! to exclude a target:

<logger name="org.jzonic.jlo">    
  <targets>ALL,!DEBUG,!INFO</targets>
  <generator-name>TestGenerator</generator-name>
</logger> 

This one will switch on all except debug and info.


The next logical step will be that you can define your own targets for your own purposes. Why not define a target like startup or sql or whatever. The next version of jLo will include a code generator that lets you define the targets and build your own jLo version.