Home of: [Atelier "FUJIGURUMA"] >> [PTLog hosted by SourceForge.net]

SEE "For Readers of English Version",
or Japanese version of this page

Motivation

This document explains motivation to develop PTLog.

Requirements

This section explains "my" requirements to logging framework shown as below.

  1. pluggability
  2. custom category
  3. type-based categorization
  4. value formatting
  5. packing into one record

Though it may be only for "me" but not for "you", I think many people has same requirements.

Pluggability

Recently, there are some major logging framework: JDK Logging API, Apache Log4j and Jakarta Commons Logging are famous ones.

And so, it depends on logging framework usage of runtime environment (e.g.: application server) or companion libraries(e.g.: DBMS access, presentation automation, and so on) that which logging framework should be chosen.

So, I want "pluggability" of underlying logging framework to:

Custom category

I want to define my custom categories to categorize log output.

"Custom category" is almost as same as "custom level" in ordinary logging framework.

Type-based categorization

Almost all logging framework use scalar "log level" value as threshold of logging output(= categorization).

For example, it is assumed that you define "SQLDebug", "NetworkDebug" and "LogicDebug" level.

Could you decide which level is prior than others at compilation time? "SQLDebug" is prior than others when I focus on SQL implementation. But "NetworkDebug" or "LogicDebug" may be so at another situation.

Priority between each levels seems to depend on phase of development/maintenance.

So, I want the category hierarchy which allows unordered relation.

In addtion to it, I also want to treat all "SQLDebug", "NetworkDebug" and "LogicDebug" as "Debug" in some situations.

And class hierarchy of Java seems to fit such purpose. So, I call it "type-based" categorization as opposite of "scalar-value-based" categorization.

Of course, I also want the mechanism to determine priority between each categories at runtime.

Value formatting

For example, I want to format numerical value in hex-decimal style.

Sometime I want to specify format explicitly, but sometime I want to format all values in a format.

Packing into one record

I want to dump method parameters in the format shown below.


p1=first,p2=second,p3=third,....

packing into one record

But all known logging frameworks force me to concatenate string pieces by "+" operator.


logger.debug("p1=" + p1 + ",p2=" + p2 + ",p3=" + p3 ....);

concatenate string pieces

I want more elegant way to pack information into one record.

Reason why not other frameworks

Requirements satisfaction in each logging frameworks is shown below.

requirement JDK Logging API Apache Log4j JCL
pluggability no no yes
custom category yes yes no
type-based categorization no no no
value formatting no no no
packing into one record no no no

To satisfy all requirements, I conclude that I must develop new framework by myself.