Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 9. Logging > Logging Output

Logging Output

Running the code as shown in Listing 9-1 will produce two different output streams. First, System.out (normally, the console) will produce the output as shown in Listing 9-2.

Listing 9-2. Logging Example

Added JDK 1.4 file handler

Test fatal log
Mar 22, 2004 9:04:06 PM com.cascadetg.ch09.LogGenerator main
SEVERE: null
java.lang.NumberFormatException: null
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.<init>(Unknown Source)
    at com.cascadetg.ch09.LogGenerator.main(LogGenerator.java:44)

Test error log
Mar 22, 2004 9:04:06 PM com.cascadetg.ch09.LogGenerator main
SEVERE: null
java.lang.NullPointerException
    at com.cascadetg.ch09.LogGenerator.main(LogGenerator.java:56)

Test warn log
Mar 22, 2004 9:04:06 PM com.cascadetg.ch09.LogGenerator main
WARNING: Can't find a non-existant class!

Test info log
Mar 22, 2004 9:04:06 PM com.cascadetg.ch09.LogGenerator main
INFO: Starting app!
Mar 22, 2004 9:04:06 PM com.cascadetg.ch09.LogGenerator main
INFO: Quitting app!

Test debug log

Test trace log

Log test complete.


					  


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint