Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Hamish Jones   on Jul 04 In Java Category.

  
Question Answered By: Faeezah Khan   on Jul 04

You should look into using a logger class  that is already built (such as log4j -
http://jakarta.apache.org/log4j - or the logging api built into java 1.4). They
are
very comprehensive and should meet your logging needs. The approach they use is
not
what you are listing here but you may be happier with the methodology they use
than
the one you are proposing.

Also please note that if you catch any exception you can print out a full stack
trace (names and line numbers of the error) by calling its stack trace method.
This
does not require a logger class although it can be used in conjunction. For
instance:

catch (Exception e) {
System.err.println(e);
e.printStackTrace();
}

The exception class has methods in it that can be used to send error information
to
your log as well.

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on get reference to container class Or get search suggestion and latest updates.


Tagged: