You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Hibbs, David" <Da...@ANICO.com> on 2003/06/18 16:52:29 UTC

Best Practice [WAS: Logging in struts].

Anyone have any comments on using the log( String, int ) method on the
ActionServlet?  i.e. in an action

getServlet().log( "This is for debug only", 2 );

will only log the message if the debug level is 2 or greater...

However, now that I'm looking at this in the user Guide (which I've had
little reason to do for a while <g/>) in the section about the action
servlet
(http://jakarta.apache.org/struts/userGuide/configuration.html#dd_config_ser
vlet), I see that the debug init parameter is deprecated.  However, the
previously mentioned log method is _not_ deprecated and _is_ public, which
seems to be rather silly.

Reviewing the following links for information on configuring logging...

http://jakarta.apache.org/struts/userGuide/configuration.html#config_logging
http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/pac
kage-summary.html#package_description
http://jakarta.apache.org/commons/logging/api/index.html

...reveals the non-deprecated ways of configuring logging.  The question,
then, is what is the best practice on how to do so?  

My WEB-INF/classes folder is slapped with a .cvsignore, so dropping a
commons-logging.properties file in there will mean it never ends up in
version control.  So where should it go as a best practice?

David Hibbs
Staff Programmer / Analyst
Distributed Applications Development and Support
American National Insurance Company


> -----Original Message-----
> From: Simon Kelly [mailto:kelly@ipe.fzk.de]
> Sent: Wednesday, June 18, 2003 3:24 AM
> To: Struts Users Mailing List
> Subject: Logging in struts.
> 
> 
> Hi all,
> 
> I didn't really want to post such a basic question, but I have tried a
> couple of possible solutions and have had zero luck.  So,
> 
> How do you log messages using the Struts logger, so that they 
> will print to
> screen? I.E the window that tomcat is running in, in my case.
> 
> Thanks, cheers etc etc
> 
> Simon
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org