Hi Fabio,

> There is a log4j.properties alongside the stripesResources.properties file in
> the Stripes-Quickstart tarball, but none in the book's code .

Actually, there is a log4j.properties file in the book's code as well. It
is under code/shared/res/log4j.properties. When you build an example, that
file ends up on the classpath.

> But how do I use it? All is needed is to configure this file and that's all?

You need the log4j.properties on the classpath (typically under WEB-INF/classes)
and log4j-1.2.xx.jar under WEB-INF/lib.

> What if I want to create a DEBUG mode for tracing tests and a deployment mode
> for production?

I'm not sure how you would do that without changing anything, i.e. have the
deployment mode be 'detected' and the logging level be set accordingly. But
otherwise you would just set the mode to DEBUG while you are developing and
and to ERROR when you are ready to deploy to production.

> What about piping the log to another file?

Have a look at the log4j.properties example from the book's code, you'll
see how to log to a file, webmail.log in your home directory in this example.

> Is there any way to call it directly within the stripes framework?

Stripes includes util.Log which logs to commons-logging, which in turn logs
to Log4J. For example:

private static final Log log = Log.getInstance(YourActionBean.class);

log.debug("Your log message");

Hope that helps!

Cheers,
Freddy
http://www.stripesbook.com


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to