I work on Large projects for multinational companies as a technical Lead. My company developes and delivered strategig software solutions to these companies. One of the issues that ALWAYS comes up is performace.Yes there are books on how to make JAVA more efficient, but one of the most common causes of bad performance has nothing to do with the application code whatsoever. LOGGING is one of the major causes of performance degradation in large applications.
the above concactenates a string which is an expansive JAVA operation.
Doing it like this helps if using LOG4J
The conditional check saves the trouble of running the logger at all depending on its settings.
Note that even when set to just log ERRORs, the actual work of concactenation still gets performed.
An Even better way to do this is to use a String Buffer to append the values you want to log...Like
logger.debug("I am here with " + someVariable + someValue)
the above concactenates a string which is an expansive JAVA operation.
Doing it like this helps if using LOG4J
if (logger.isDebugEnabled()
logger.debug("I am here with " + someVariable + someValue)
The conditional check saves the trouble of running the logger at all depending on its settings.
Note that even when set to just log ERRORs, the actual work of concactenation still gets performed.
An Even better way to do this is to use a String Buffer to append the values you want to log...Like
If(logger.isDebugEnabled ())
logger.debug(new StringBuffer(200).append(" I am here with ").append
(someVariable).append(SomeValue).append
(someVariable).toString());
0 Comments On This Entry
← February 2022 →
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 |
Tags
My Blog Links
Recent Entries
-
Java Performanceon Jul 04 2008 12:49 AM
Search My Blog
0 user(s) viewing
0 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)



Leave Comment








|