20051220 Tuesday December 20, 2005

Growing a Log

Tonight, I added a couple of more capabilities to the Blammo logging framework. Some of it has been done in order to provide some suppport for Sun's Unified Logging Format. The Unified Logging Format dictates that the message id is prefixing the actual message. Blammo already allowed you to specify the message id explicitly, but I wanted to have Blammo generate it for me, so I added that capability. Additionally, I added a mechanism to copy the JavaDoc comments for a certain event to the message catalog as an explanation.

That means that a message catalog could now potentially look like this:

The message ids have been generated, using the BLAM prefix and starting from message number 200. Both these properties are specified in the relevant section in your Maven pom:

      <plugin>
        <groupId>com.agilejava.blammo</groupId>
        <artifactId>blammo-maven-plugin</artifactId>
        <version>0.1-SNAPSHOT</version>
        <configuration>
          <messageIdPrefix>BLAM</messageIdPrefix>
          <messageIdOffset>200</messageIdOffset>
        </configuration>
      </plugin>

The additional comments for a certain message have been copied from the interface definition of the logger:

    /**
     * @blammo.logger
     */
    public interface EventLogger {

        /**
         * The application has attempted to divide something by zero, which is
         * impossible. This is a bug.
         * 
         * @blammo.level warn
         * @blammo.message Attempt to divide {a} by {b}; returning 0 instead.
         */
        void logDivisionByZero(int a, int b);
( Dec 20 2005, 11:16:12 PM CET ) Permalink
Comments:

Post a Comment:

Comments are closed for this entry.