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.