B.8. Testing LoggingNow that we've developed all the logging code and infrastructure, let's test the application to ensure that everything still works properly. Here are the steps to build and deploy the application:
The Initialization Servlet runs at startup time, and you should see this message in the JAW Motors logfile, ${log4j.log.dir}/jbossatwork.log: 2005-06-06 17:24:02,923 INFO [com.jbossatwork.InitServlet] - Testing Logging Setup ... Now point your browser to http://localhost:8080/jawthis takes you to the JAW Motors home page. After running a credit check and buying a car, the log messages in the ${log4j.log.dir}/jbossatwork.log file should now look like this: 2005-06-06 17:24:02,923 INFO [com.jbossatwork.InitServlet] - Testing Logging Setup ... 2005-06-06 17:25:19,163 INFO [com.jbossatwork.ControllerServlet] - Credit Check: 2005-06-06 17:25:19,163 INFO [com.jbossatwork.ControllerServlet] - Name = [Tom] 2005-06-06 17:25:19,163 INFO [com.jbossatwork.ControllerServlet] - SSN = [[345834[958[34]] 2005-06-06 17:25:19,163 INFO [com.jbossatwork.ControllerServlet] - Email = [fred@acme.org] 2005-06-06 17:25:19,293 INFO [com.jbossatwork.ejb.CreditCheckProcessorBean] - CreditCheckProcessorBean.onMessage( ): Received message. 2005-06-06 17:25:19,293 INFO [com.jbossatwork.ejb.CreditCheckProcessorBean]-- Credit Check: 2005-06-06 17:25:19,293 INFO [com.jbossatwork.ejb.CreditCheckProcessorBean]--Name = [Tom] 2005-06-06 17:25:19,293 INFO [com.jbossatwork.ejb.CreditCheckProcessorBean] - SSN = [[345834[958[34]] 2005-06-06 17:25:19,293 INFO [com.jbossatwork.ejb.CreditCheckProcessorBean]-- Email = [fred@acme.org] 2005-06-06 17:25:19,303 INFO [com.jbossatwork.ejb.CreditCheckProcessorBean]-- Verifying Credit ... 2005-06-06 17:25:26,804 INFO [com.jbossatwork.ejb.CreditCheckProcessorBean]-- Credit Check Result = [Pass Credit Check] 2005-06-06 17:25:26,844 INFO [com.jbossatwork.ejb.CreditCheckProcessorBean]-- Sending Email to [fred@acme.org] ... 2005-06-06 17:25:48,465 INFO [com.jbossatwork.ControllerServlet] - carId = [99], price = [13500.0] |