Re: Logging with Jakarta log4j - How to avoid depencies?
From: Roman (anonuser_at_shaw.ca)
Date: 01/26/04
- Next message: Y2KYZFR1: "Re: Game Company- Java Server Thread Priority"
- Previous message: BlackHawke: "Re: Problem Solved!"
- In reply to: Jan van Mansum: "Logging with Jakarta log4j - How to avoid depencies?"
- Next in thread: Jan van Mansum: "Re: Logging with Jakarta log4j - How to avoid depencies?"
- Reply: Jan van Mansum: "Re: Logging with Jakarta log4j - How to avoid depencies?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 26 Jan 2004 06:32:05 GMT
Just as a quick idea, could'nt you check if the log4j Logger class exists on
start up through java reflection?
If it exists you would use the logger and if it does not there will be no
logging done.
Of course you can wrap this functionality in a class that would do the
checks upon start up.
You could also try to catch the ClassNotFound exception where ever you use
log4j and do nothing about it.
Not sure if that helps.
Roman.
"Jan van Mansum" <jvm@nospam.com> wrote in message
news:40143a91$0$318$e4fe514c@news.xs4all.nl...
> Hello group,
>
> I have just been trying out the log4j library. As far as I understand
> the idea is to keep the logging statements in your, even in the release
> build. However, obviously you wouldn't want to have to ship the log4j
> jar with your app, to avoid class definition not found exceptions. As
> a matter of fact you wouldn't want the end user to be able to turn on
> logging.
>
> I have been thinking about how to handle this. The only thing I can
> come up with so far, is just create a couple wrapper classes round the
> log4j classes and replace them with empty onces at build-time.
>
> Is this the only way to handle this problem? Has someone out there found
> a more elegant way?
>
> Thanks in advance,
> regards,
> Jan van Mansum.
- Next message: Y2KYZFR1: "Re: Game Company- Java Server Thread Priority"
- Previous message: BlackHawke: "Re: Problem Solved!"
- In reply to: Jan van Mansum: "Logging with Jakarta log4j - How to avoid depencies?"
- Next in thread: Jan van Mansum: "Re: Logging with Jakarta log4j - How to avoid depencies?"
- Reply: Jan van Mansum: "Re: Logging with Jakarta log4j - How to avoid depencies?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|