So, are you saying realtime applications should be careful then?


Not particular, just that your mileage may vary (YMMV). If 100% of log requests are appended, then the getLogger() overhead is trivial. If 100% of the log requests are short-circuited and disposed, then the cost of a getLogger() call per request may be most of the total logging expense. For any particular application, you would need to be some profiling to see where the application bottlenecks are.

When people are using log4j in an application where performance is a concern and logging is only used for diagnostics, the major goal is that performance with logging disabled approaches that of the same code with no logging statements at all. Using static instance variable to hold a logger may cause the app to start up just a little slower, but it doesn't cost you every time through a method or loop like calling getLogger() in the body of the code. Whether that incremental cost is significant depends on what else is going on in that loop or method.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to