Posts tagged with “logging”

simply logging

Friday, 5 August, 2005

Up until now, I have used Log4j in most of my development efforts — be they personal, open-source or corporate (there’s an argument I should have been using a logging bridge of some kind, to insulate any 3rd party users of my code from having to use my logging system of choice — but most of the work I’ve been doing hasn’t had a huge number of 3rd party users, so it hasn’t been that much of an issue). However, I recently came across Graham Lea’s simple-log; the basic premise of which appeals to my drive to simplify things as much as possible. So, bye bye, Log4J, it’s been great!

I’m currently running a couple of java applications which rely on the commons-logging bridge, alongside of which I use velocity (which itself uses Avalon LogKit or Log4J by default). In order to integrate simple-log and drop log4j out of my lib path, I need to provide a logging implementation for commons-logging, and also change the default velocity runtime logsystem.

SimpleLogger.java (stick your own package in front of it), does both. To use it, make sure you set the runtime property for commons, e.g.:


-Dorg.apache.commons.logging.Log=yourpackagehere.SimpleLogger

and then set the logsystem for velocity (where ve is the VelocityEngine), using the same property:


ve.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS,     System.getProperty('org.apache.commons.logging.Log'))

Read the rest of this entry »

reverse logging proxy

Tuesday, 2 August, 2005

There are a number of transparent/reverse proxy applications available, but I’ve thus far been unable to find one suitable for my needs. They’re either too low level (sniffing TCP packets for example), or intended for other purposes; and as a consequence either don’t present the right info in the right format, or just too gosh-dratted [sic] complicated for me to bother figuring out. Thus, in true lazy-programmer fashion, I’ve written my own quick-and-dirty tool for the job (actually when I say written, I really mean thrown together a few lines of code with some python modules which are doing the real work).

logproxy.py takes a hostname as its argument and redirects all requests to that host, in the meantime logging the headers and content body (if content has been sent). The response is also logged, and then sent back to the client accordingly.

Read the rest of this entry »