Essentially we are looking for the best practices to accomplish [error handling and logging] in an object-oriented Perl application.
Logging and error handling are two separate beasts, related only in that you typically want to log errors.
I've build logging into OO and non-OO applications, and there's really not much difference (other than having a logging singleton to pass log messages to). What really matters is what you choose to log and how frequently. That'll depend entirely on your application. I typically log all user actions and any errors or warnings, then provide switches to throw to cause additional detail to be logged (such as SQL queries).
The "best practice" I can recommend is to hold a discussion session to answer the question "what kind of information are we going to need in logs to diagnose problems?" Throw a couple of realistic candidate problems onto the table, then talk through what info you'd like to see logged, and who needs to do the logging. And alway include timestamps with each log message.
I'd be careful about tying error handling and logging together, other than to make a call to the logging object from your error handling object/code.
|