|
I haven't been following this thread too closely, but has anyone suggested Log4J to you? It is built to allow for multiple levels of logging output to various destinations (screen, log file, etc). You can actually tune it so that messages have varying levels of severity, and you can also configure each destination to only emit messages of certain levels. Basically, I would suggest that you have a centralized error handler that decides what to do with each error it gets. You can accomplish this via a single class that actually handles all your errors, or you could do this through inheritance. When your main error handling code gets the error, it can get information about the exception, or the classes that call this handler can assign levels to the exception, and then your error handler can send the error to the logging framework for processing. If you are using JDK 1.4, you already have this capability. You can add this capability to JDK 1.3 by downloading Log4J from the Apache project (http://logging.apache.org/log4j/docs/), and adding the Log4J jar(s) to your classpath. Chris DeLashmutt Senior R&D Analyst LeasePlan USA 1165 Sanctuary Pkwy., Alpharetta, GA 30004 Phone: 678-202-8695 Fax: 678-921-4895 ClearCase problems? Check out the LeasePlan ClearCase FAQ for answers! "Clapham, Paul" <pclapham@core-mark To: "Java Programming on and around the iSeries / AS400" .com> <java400-l@xxxxxxxxxxxx> Sent by: cc: java400-l-bounces@m Subject: RE: Creating customer Exception class idrange.com 02/09/2005 06:48 PM Please respond to Java Programming on and around the iSeries / AS400 No, that sounds like a reasonable design. But it would be possible to have "e.getMessage()" return the application's error message and "e.getCause().getMessage()" return the actual error message. The difference between that design and your proposed design is what happens when your customized Exception gets handled by some generic code (e.g. error logging) that only handles Exception. That code can't call your customized appLevelMessage method. So if you have such a thing, then it depends on how you want that code to behave. PC2 -----Original Message----- From: java400-l-bounces+pclapham=core-mark.com@xxxxxxxxxxxx [mailto:java400-l-bounces+pclapham=core-mark.com@xxxxxxxxxxxx] On Behalf Of Lim Hock-Chai Sent: February 9, 2005 14:53 To: Java Programming on and around the iSeries / AS400 Subject: RE: Creating customer Exception class Yes. There is already a message field in the Exception class. The reason that I want to create an additional appLevelErrMsg is because I want to retain everything that is in Exception. appLevelErrMsg is more for what the user will see. The message in Exception class is the actual error message that could help programmer debugging problem. Do you think that is redundant? -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. "e-mail disclaimer: This message (including any attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorised use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. LeasePlan Corporation N.V. (including its group companies) shall not be responsible nor liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt or damage to your system. LeasePlan Corporation N.V. (or its group companies) does not guarantee that the integrity of this communication has been maintained nor that this communication is free of viruses, interceptions or interference."
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.