To figure out how much memory is used by log4j, I wrote a small test application, creating a window frame, contains a scroll table, some labels and several Buttons connected with listeners etc.
The log4j I used with two appenders: console and rolling file, both with different pattern layout.
I’ve build three different versions of this test application, 1) naked, 2) with System.out.println(), 3) with log4j – one logger.info() replaces one println(),
I calculated the number of inserted code lines versus the amount and ratio of bytes have increased the class files.
Here are the results of my investigations:
Test Application: 1) naked 2) println() 3) logging() total Code lines: 420 435 440 print/log Code lines: 0 15 20 total class bytes: 17118 18054 18892 code line ratio: - 3,4 % 4,5 % class byte ratio: - 5,5 % 10,4 %
Conclusion:
Replacing legacy System.out.println() by logging with log4j doubles the amount of memory used in addition to a naked (non traced) application.
In other words, if one application uses 10 % of its code for System.out.println(), its amount in bytes will increase 10 % when replaced by log4j.
So if we were stingy logging, it wouldn’t burst our system.
But the library log4j-1.2.8.jar could be too big for us.
Is it possible to simply remove unused classes - as for instance xml - from the library to slim it?
Thanks, Ralf
Shapira, Yoav schrieb:
Hi, I don't know, but it wouldn't be difficult to track with a profiler, and then please post the results to the list as I'm sure others are curious ;)
Yoav Shapira Millennium Research Informatics
-----Original Message-----
From: Ralf Beger [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 14, 2004 11:16 AM To: [EMAIL PROTECTED] Subject: How big is log4j?
How big is log4j?
I'm looking for a logging tool in embedded systems. The performance of log4j would meet our expectations. We want to use log4j in a mid extent (up to 3 Appenders: console, file, syslogd). But how much memory needs log4j, once compiled with an application.
Kind regards, Ralf
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]