Originally posted by Sonny Gill:
Why arent you using java.util.logging or log4j to log from POJOs?
I am, the log4j that's setup in my context.xml logger tag. Maybe I overlooked how to get ahold of the log from a pojo (I got a log, but not the one for the context), but even if I did, it seemed to be a lot of work (as opposed to the easy access from a servlet)
What I'm after here is the ability to create a record of something that goes wrong. Let's face it, the user will almost always call and say "the program didn't work right...no, no, I don't recall what it said...no, I don't recall what I did before that...um, I don't know...can you fix it?"
As far as propogating out to handling with the web.xml, I'm not familiar with the technique, even if I was, I'd like to log the event and send it on it's merry way and/or give the user a "something bad happened, please call support" message.
:\
Anyway, I'm not talking about suppressing RuntimeExceptions, I guess it's more of a design question. ie: should I pass a reference to the log I want to use to my database handling pojo so it can log problems and return error conditions, or should the database handler throw exceptions that calling servlets log?