Chapter 15. Logging in a Struts Application

As dedicated and knowledgeable Java programmers, we always want to believe that the software we create will stand up to the utmost scrutiny. However, as human beings, we’ll all fallible, so it’s never a good practice to believe that our software contains no defects. The important thing is to use every means available to try to eliminate the defects, or at least reduce them to an acceptable amount.

Generating log messages that tell you what the application is doing can help you locate any defects that are present in your software. However, logging is important for other reasons as well. For example, security and auditing might depend on logging to provide information to the system administrators about what the authorized and, more importantly, unauthorized users of the application are doing. By providing real-time information about potential security attacks on the application, logging can give a much-needed edge to the system administrators and allow for quicker reactions to attacks.

This chapter takes a close look at how the use of logging in your Struts application can help you identify defects before the application gets into production, or, if your software is already being used in production, how logging can help you to quickly identify problems with the software and arrive at solutions.

Logging in a Web Application

The importance of logging has been evident to experienced developers for many years. Arguably, logging can be as important a part of your framework as exception handling or even security, both of which may rely on logging functionality to help carry out their responsibilities. Without logging in an application, maintenance can become a nightmare for the developers. We all know that all “real” applications periodically go through maintenance cycles.

Still, you may wonder whether logging in web applications is as necessary and important as logging in other types of applications. Because web applications can sometimes be smaller and less complex than their enterprise counterparts, you might think that logging is less important in these applications. However, with nontrivial web applications, this is not the case—logging is just as critical there as it is in an enterprise application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.14.245