configLog4j

 

context:

 

  • you are using log4j.
  • you have each object log to a category
    of the same name as the object's class.
  • you got a java runtime environment version 1.2 or higher to run configLog4j on.
problem:

configuration of lots of categories
gets tedious.

possible solution:

configLog4j permits a graphical
configuration of the log4j system
including the possibility to save
configured use cases by name.

benefit:

extremely flexible use case tracking
[ a use case involving classes A, B and C can be tracked by setting the
priority "hurdles" of A, B and C's
categories low (e.g. "DEBUG") and for
all other classes' categories high
(e.g. "WARN") ]

 

contents:

 

screenshot explanation:

  • configLog4j displays packages and source files of all source trees used for your project.
    (In the screenshot below the source trees are:
    • java
    • javax
    • org

    )

  • each class has a bullet-like icon next to it
    showing
    its priority (see arrow "3" in the screenshot)
  • each package has a box-like icon next to it
    showing which priorities its contained classes and subpackages have.
    ("2" has priorities ERROR/WARN/DEBUG because the three contained classes have each got these priorities)
    ("1" has all priorities because it contains classes of priority INFO and subpackages which in turn contain classes and/or subpackages of the other priorities)

 

 

what you can do with configLog4j:

  1. you may set priorities for individual classes or for a package symbolizing its whole subtree and thus setting the priorities of all contained packages and classes recursively
    (keep in mind that each class corresponds to one category !)
    One such setting will be called "configuration".
  2. you may save a configuration under a name of your choice.
    And you may recover one you saved previously.
    (->configuration menu)
  3. finally you push "generate" and the configuration-file
    corresponding to the current configuration will be generated
    at the path shown - ready to be read in by log4j.

 

how is the log4j-configuration file generated ?

the configuration-file for log4j is generated by merging the provided header file, trailer file and the text generated by configLog4j.
this approach gives you lots of flexibility since you can edit the header file (defining appenders, conversion pattern etc.) as you like.
the trailer file would only be needed for the xml-config file but is used for consistency also when generating the properties config file

how is configLog4j configured ?

configLog4j is configured by a properties file - a path to which you pass on the command line.
within this prop file the paths to header, trailer, target file etc are specified.

 

 

demo installation

configuring log4j via PROPERTIES file

windows system:

  1. extract the contents of the zip file to C:/tmp/
  2. in a dos-prompt in that dir, type in a SINGLE line:
    java -cp C:/tmp/configLog4j.jar
    de.japhy.tools.configLog4j.ConfigLog4j C:/tmp/config/configLog4j_windows_props.properties

  3. configLog4j will tell you where it generates the config file
  4. hope that it works

unix system:

  1. extract the contents of the zip file to /tmp/
  2. in a dos-prompt in that dir, type in a SINGLE line:
    java -cp /tmp/configLog4j.jar
    de.japhy.tools.configLog4j.ConfigLog4j /tmp/config/configLog4j_unix_props.properties
  3. configLog4j will tell you where it generates the config file
  4. hope that it works

configuring log4j via XML file

windows system:

  1. extract the contents of the zip file to C:/tmp/
  2. in a dos-prompt in that dir, type in a SINGLE line:
    java -cp C:/tmp/configLog4j.jar
    de.japhy.tools.configLog4j.ConfigLog4j C:/tmp/config/configLog4j_windows_xml.properties

  3. configLog4j will tell you where it generates the config file
  4. hope that it works

unix system:

  1. extract the contents of the zip file to /tmp/
  2. in a dos-prompt in that dir, type in a SINGLE line:
    java -cp /tmp/configLog4j.jar
    de.japhy.tools.configLog4j.ConfigLog4j /tmp/config/configLog4j_unix_xml.properties
  3. configLog4j will tell you where it generates the config file
  4. hope that it works