Log4J logging - Generic Service

I am trying to create a generic service that will take as inputs the name of a service and the logging level and log it using log4j.

Say Service1 is my generic service, and the inputs to this service are Service2 and ERROR, I want service1 to log only when there are ERRORS in Service2.

I have been trying without luck for a while now. Can anyone give me an idea of how this can be done?

Mark!(If you read this post!!) I downloaded your logging.zip package and I am trying to use it. Can you suggest a path to do what I am trying to do?

Thank you all in advance!


Have a look at this Log4J logging example.



I am using something similar to this logging package. It works fine (for a while) after I initialize using PropertyConfigurator… a day or two later, it stops logging to the rolling log file.
I have to manually invoke the service (that calls configure) to start logging,

if (logger.isEnabledFor(p)) {


it goes in to the above if block, which means logger is not null or anything, but when logger.log(…) is called in that block, nothing happens. I have this wrapped in try/catch and calling pub.flow.debugLog in catch, nothing in the server log either…

I just changed to DailyRollingFileAppender… I am hoping that might make any difference…