Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Very fast loggers ?  RSS feed

 
Sol Mayer-Orn
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would anyone happen to know of good Loggers, that are *really* optimized for performance ?

We're migrating an appliction from C, with crazy demands on performace, on a relatively weak machine... we actually got to the point of tinkering with the Garbage collection, and using Optimizeit very often...

So, we're looking for a logger with features such as:

1.
Something like log4J Async File Appender (separate thread does the IO).
It would be nice to have some more configurability - e.g. if the logging queue gets full, we'd rather dismiss some log records, than get stuck on waiting.

2. Very careful memory management (I'm not sure, but I think log4j allocates 'LogRecords' or some similar type of class, which means it's hard of the Garbage collection... We'd rather miss some functionalilty (nice formatting, accurate date), than hurt performance...


Thanks very much.
 
Joe Ess
Bartender
Posts: 9428
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sol Mam-Orn:
. . . on a relatively weak machine...


Have you considered a hardware upgrade? You could probably get orders-of-magnitude improvement by getting an upgrade for (let's be extravagant here) a couple thousand dollars. You aren't going to get that kind of improvement tinkering with a logging implementation no matter how long you work on it. Developer time is way more expensive than computer equipment. Do a cost-benefit analysis and forget about tinkering.
 
Isuru Sampath
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One got to be very careful when calling the System.gc as when the garbage collector is operating, the actual program execution on the JVM pauses. (GC and your program does not execute in parallel).

If you want to conserve memory, I would suggest you design your classes carefully and the object instantiation. Simple practices like, avoiding the creation of object references within loops and usage of StringBuffer instead of String could do a lot of difference in this aspect.

However, if you are interested in conserving the CPU time I suggest that invoking the Garbage collector is a relatively poor option. You can hint the Garbage Collector to do the job automatically by setting your unused object references to null.

If Log4J is too heavy for your resource limits you can always use java.util.logging.Logger, of cause with the limited flexibilities.
[ June 06, 2006: Message edited by: Isuru Sampath ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!