Probably the most significant impact on logging is (Web design service)

Probably the most significant impact on logging is what information you attempt to log and how you format that information. log4j uses a subclass of org.apache.log4j.Layout to determine how the message should be formatted in the output destination. Using the SimpleLayout class is the fastest, as it logs only the log level and the message. On the other hand, the PatternLayoutclass allows for a great amount of flexibility in the format of the message; you can log all sorts of information, including the class creating the message, the line number, and even the Java thread that is generating the message. However, all of this additional information comes at a severe price in terms of performance. The log4j documentation contains several warning messages in the JavaDocs for the PatternLayout class stating that performance may suffer greatly if certain information is written out with the log message. You must be very particular about what information you need in the log message. You should be able to get by with the class, the level, and the message. The other information is nice to have, but in most cases it’s superfluous. Creating the message that goes into the log statement can also impact the time and performance. Creating a message using values such as: logger.debug(”Session id is: ” + sessId + ” for user ” + user.getFullName( ) ); can add significant time to logging. This isn’t related to log4j, but rather to the cost associated with making Java method calls and concatenating the strings together before the actual log statement can be generated. Finally, as mentioned earlier, loggers can be connected together in a parent/child relationship. Because the logging threshold can be assigned at any level, the log4j environment may have to search up the hierarchy to determine whether the log message should be written. If this hierarchy is very deep, this traversal can add significant time to the log statement creation. Generally, in the development stages of your application, logging costs are less important. The performance of logging shouldn’t matter that much while you’re still developing and debugging the application; in fact, this is typically where you want as much logging as the application can generate. When it’s time to go to QA or production, turn down the logging levels. With other languages, the logging code might not ever make it into the compiled binaries. Preprocessors might remove the logging code to keep the binary size smaller and prevent the log messages from showing up. However, this is not necessary using log4j you have the flexibility of controlling how much logging is done just by changing the configuration file. (Of course, the log statements are still present in the binary code once it’s compiled.) 15.7 Third-Party log4j Extensions Several helpful third-party tools and utilities are available for log4j. Most of them are free and/or open source. For example, there are several Swing-based GUI applications that allow you to view and filter log messages dynamically, which is ideal for administrators in a production environment. There are also several other types of appenders that other developers have created that might be helpful to you. You can find these third-party extensions in the log4j download area at http://jakarta.apache.org/log4j/docs/download.html. It’s definitely worth the time to take a look and see what’s there. The list of available extensions is constantly growing.
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Leave a Reply