Possible? Yes ... but you're not going to get much meaningful information. IMHO, meaningful information comes out of exceptions, and I personally trap those and cause the app to show meaningful errors to the user. The best place to have logging is in your catch statements - be that in your actions or the classes that make up your model. It's so trivial to put in that there really isn't any excuse for not doing it right the first time.

In any of the widely-accepted logging implementations, you need 4 lines of code to make it possible to do logging and about (n + (n / 2)) lines to actually do the logging (n areas you want to log - half of which you want to wrap in an "if (log.isXXXenabled())" - that's a total guestimation). Now, generally I try to keep my classes concise (I know it's not always possible!), so there aren't just a ton of places something can go wrong. ... yet another reason to do it right :-)

I'll be surprised if there's a better solution that will give you meaningful feedback out of the logging (which is why you do logging - for meaningful feedback, that is - right?), but I have been wrong many times, and I don't think I've seen my last error yet :-)

Look at commons-logging. It is a little more work up-front to learn how to work it, but you can do System.err type, and you could always plug Log4J into it (without changing your code) later if you feel the need ... or the JDK1.4 logger. It's pretty handy!

Good Luck!

Eddie Bush

----- Original Message ----- From: "Kinjal Sonpal" <[EMAIL PROTECTED]>
To: "Struts User List" <[EMAIL PROTECTED]>
Sent: Monday, November 29, 2004 7:03 AM
Subject: Automatic logging



Hi listers,

I'm developing a struts 1.2.4 based small-medium sized application
with around 35-40 JSPs, 6-8 formbeans, 6-8 DispatchActions.

I'm going to make the application available for the testing users (for
kind of blackbox functional testing). I've so far not used logging of
any kind in my application. I'm planning to introduce logging in the
application.

Would there be a simpler way of enabling automatic logging across
entire application so that I do not have to modify all of my classes
and JSP pages? My jsps are having a standard included page all across,
where probably I would like to put the logging statements. Same way I
have a BaseDispatchAction, which is inherited by all the
DispatchActions.

In summary, I'm not looking for an all out modify approach, but add
logging at strategic places and then application would record those
events.

Thanks and regards,
Kinjal Sonpal
----------------------------------------
"In the real world, the right thing never happens in the right place
at the right time.
It is the task of journalists and historians to rectify this error."
-- Mark Twain





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0448-1, 11/26/2004 Tested on: 11/29/2004 5:16:41 PM avast! - copyright (c) 2000-2004 ALWIL Software. http://www.avast.com




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to