hslogger4j: hslogger handlers for log4j's XMLLayout

[ deprecated, interfaces, library ] [ Propose Tags ]
Deprecated in favor of hslogger

Hslogger4j provides handlers for hslogger (John Goerzen's Haskell logging library) that are compatible with log4j's XMLLayout. In particular log messages created by the handlers can be published directly to the GUI-based log viewer Chainsaw v2.


[Skip to Readme]

Modules

[Last Documentation]

  • System
    • Log
      • Handler
        • System.Log.Handler.Log4jXML

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.1, 0.2
Dependencies base, hslogger, time [details]
License LicenseRef-LGPL
Copyright Copyright (c) 2004-2007 John Goerzen
Author Bjorn Buckwalter
Maintainer bjorn.buckwalter@gmail.com
Category Interfaces
Home page http://hslogger4j.googlecode.com/
Uploaded by BjornBuckwalter at 2007-10-19T14:44:23Z
Distributions NixOS:0.2
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1990 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2017-01-04 [all 7 reports]

Readme for hslogger4j-0.1.1

[back to package description]
Introduction
============
Hslogger4j provides handlers for hslogger[1] (John Goerzen's Haskell logging library) that are compatible with log4j's XMLLayout. In particular log messages created by the handlers can be published directly to the GUI-based log viewer Chainsaw v2[2].

The set of log levels in hslogger is richer than the basic set of log4j levels. Two sets of handlers are provided with hslogger4j, one which produces logs with hslogger's levels and one which "demotes" them to the basic log4j levels. If full hslogger levels are used some Java installation is necessary to make Chainsaw aware of them.

Usage of the handlers in hslogger4j is analoguous to usage of the 'StreamHandler' and 'FileHandler' in 'System.Log.Handler.Simple'. The following handlers are provided:

  - log4jStreamHandler  (hslogger levels)
  - log4jFileHandler    (hslogger levels)
  - log4jStreamHandler' (log4j levels)
  - log4jFileHandler'   (log4j levels)


Installation
============
Haskell
-------
Use the regular cabal process:

  runhaskell Setup.lhs configure
  runhaskell Setup.lhs build
  runhaskell Setup.lhs install

Java
----
This is only necessary if you want to use the hslogger levels.

Add 'hslogger4j.jar' to your classpath. To use you will also need to have the jars 'log4j-1.3alpha-7.jar' and 'log4j-xml-1.3alpha-7.jar' that are distributed with Chainsaw on your classpath.

(On Mac OS X I added all three jars to '~/Library/Java/Extensions'. It seems that it is not sufficient that Chainsaw already includes its jars in the classpath when launching -- perhaps the plugin classloader does not inherit Chainsaw's classpath. Adding the jars to '~/.chainsaw/plugins' wouldn't work either.)

If for whatever reason you have to rebuild the hslogger4j jar just run 'ant'[3]. The new jar will be created in the 'dist/lib' directory.


Usage
=====
Haskell
-------
In the IO monad:

> lh2 <- log4jFileHandler "log.xml" DEBUG
> updateGlobalLogger rootLoggerName (addHandler lh2)

> h  <- connectTo "localhost" (PortNumber 4448)
> lh <- log4jStreamHandler h NOTICE
> updateGlobalLogger rootLoggerName (addHandler lh)

Chainsaw
--------
If you are only using the basic log4j levels just use Chainsaw's regular facilities to browse logs or listen for log messages (XMLSocketReceiver).

If you want to use the hslogger levels the easiest way to set up Chainsaw is to load the plugins in 'hslogger4j-plugins.xml' when launching Chainsaw. Two receivers will be defined, one that listens for logmessages and one for reading log files. Edit the properties of those receivers as needed (e.g. port, file name) and restart them.


Copyrights and licenses
=======================
The Haskell code is copyright John Goerzen and licensed under LGPL. The Java code is copyright of the Apache Software Foundation and licensed under the Apache License. See the source file headers for details.


Bugs, patches and stuff
=======================
Send to bjorn.buckwalter@gmail.com.


References
==========

  [1] http://software.complete.org/hslogger
  [2] http://logging.apache.org/chainsaw/
  [3] http://ant.apache.org/