it would improve the (Multiple domain web hosting) performance of the application
it would improve the performance of the application if the append statements were not all executed when the logging threshold was set to not log debug statements. You can use the isDebugEnabled( )method for this: if ( log.isDebugEnabled( ) ){ StringBuffer buf = new StringBuffer( ); buf.append( “Login Successful - ” ); buf.append( “Name: ” ); buf.append( userView.getFirstName( ) ); buf.append( ” ” ); buf.append( userView.getLastName( ) ); buf.append( ” - ” ); buf.append( “Email: ” ); buf.append( userView.getEmailAddress( ) ); // Log the UserView for auditing purposes log.debug( buf.toString( ) ); } In this case, the application is not wasting time creating the StringBuffer only to have it not be used. 15.3.3 Struts Framework and the Commons Logging Package The Struts framework does perform some limited internal logging, and also uses the Commons Logging API. Thus, the Struts framework will use whichever logging implementation you configure for your application. The Struts logs are a great way for you to see what’s going on inside Struts as it processes requests, but other than for debugging purposes, there’s no need for you to worry about them. In most production environments, the messages generated by the Struts framework should be disabled. The manner in which you disable the framework-specific log messages depends on which logging implementation you choose. The rest of this chapter is devoted to one of the most popular logging implementations used by developers, log4j. Because it’s also supported by the Commons Logging package, it’s an excellent choice for your Struts application’s logging needs. 15.4 Using the log4j Package You may have heard or read about the log4j library from other sources, but in case you haven’t, let’s briefly discuss the library’s history here. Like Struts, log4j is an open source project that is part of the Jakarta set of projects. It’s essentially a set of Java classes and interfaces that provides logging functionality to multiple types of output destinations. It has been around for several years and is constantly being refined and tuned for all types of Java development. In fact, log4j has been so successful that it has been ported to several other very popular languages, including C, C++, Python, and even .NET.
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.