You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by problems mail <pr...@gmail.com> on 2007/08/08 17:07:11 UTC
Re: Access logging
Sorry to resurrect this thread. But there is no documentation on how to do
logging in Geronimo.
I looked through the classes and see GeronimoLog and others, but no usage on
any of these from a JSP.
Do we have to include log4j jar files as part of our WEB-INF/lib folders ?
-- Simon
On 6/28/07, solprovider@apache.org <so...@apache.org> wrote:
>
> On 6/28/07, bdushok <bd...@luzerne.edu> wrote:
> >
> > Can anyone point me toward any documentation on how to set up access
> logging?
> > I have apps running on Geronimo 1.1.1 and would like to obtain access
> info
> > for individual jsp pages and servlets.
> >
> > Thanks,
> > Bob
>
> Logging hits is problematic on the Web. Are you checking server load,
> or do you want the actual number of times each page is opened?
>
> For server load, check the logs of the http engine. For Geronimo,
> those logs would be generated by Tomcat or Jetty.
>
> For secure pages, the server logs may also be good enough since the
> browser will usually contact the server.
>
> For the real number of times a page is opened or a link is clicked,
> you need to work around Internet caching. That requires JavaScript or
> some other technology that can dynamically generate URLs. Google
> Analytics is a free version. I recently wrote a simple WAR to handle
> this for a confidential application with two parts:
> 1. JavaScript added to every page or link you want to log. The URL
> must be unique. I add the datetime and a random number to make
> certain each URL is unique. This required 5 lines of JS for a
> function plus one call for each item being logged (the page or a
> link.)
> 2. A Servlet that accepts the URL and logs information. I used log4j
> so the Java code fit on one screen. I made almost everything
> configurable from web.xml.
>
> solprovider
>
--
Regards,
Simon
Re: Access logging
Posted by Jason Warner <ja...@gmail.com>.
Hey Simon,
Some basic logging information can be found on the geronimo coding standards
page found here: http://geronimo.apache.org/coding-standards.html
The highlights of this page as pertains to your question are:
- Log as much as necessary for someone to figure out what broke
- Use org.apache.commons.logging.Log rather than raw *Log4j*
- Do not log throwables that you throw - leave it to the caller
- Use flags to avoid string concatenation for *debug* and *trace*
- Cache flags (especially for *trace*) to avoid excessive
isTraceEnabled() calls
As to including the log4j jar in your WEB-INF/lib, I don't believe that's
necessary. If log4j is already being pulled into geronimo, you can just add
a dependency in your geronimo-web.xml. I think you're also going to need a
dependency on commons-logging as well, from what my previous copy/paste
says. I'm not positive of that though, and I lack a geronimo install to
check so maybe someone with more know-how could chime in with a yay or nay.
Hope this helps,
Jason Warner
On 8/8/07, problems mail <pr...@gmail.com> wrote:
>
>
> Sorry to resurrect this thread. But there is no documentation on how to do
> logging in Geronimo.
>
> I looked through the classes and see GeronimoLog and others, but no usage
> on any of these from a JSP.
>
> Do we have to include log4j jar files as part of our WEB-INF/lib folders ?
>
> -- Simon
>
>
> On 6/28/07, solprovider@apache.org <so...@apache.org> wrote:
> >
> > On 6/28/07, bdushok <bd...@luzerne.edu> wrote:
> > >
> > > Can anyone point me toward any documentation on how to set up access
> > logging?
> > > I have apps running on Geronimo 1.1.1 and would like to obtain access
> > info
> > > for individual jsp pages and servlets.
> > >
> > > Thanks,
> > > Bob
> >
> > Logging hits is problematic on the Web. Are you checking server load,
> > or do you want the actual number of times each page is opened?
> >
> > For server load, check the logs of the http engine. For Geronimo,
> > those logs would be generated by Tomcat or Jetty.
> >
> > For secure pages, the server logs may also be good enough since the
> > browser will usually contact the server.
> >
> > For the real number of times a page is opened or a link is clicked,
> > you need to work around Internet caching. That requires JavaScript or
> > some other technology that can dynamically generate URLs. Google
> > Analytics is a free version. I recently wrote a simple WAR to handle
> > this for a confidential application with two parts:
> > 1. JavaScript added to every page or link you want to log. The URL
> > must be unique. I add the datetime and a random number to make
> > certain each URL is unique. This required 5 lines of JS for a
> > function plus one call for each item being logged (the page or a
> > link.)
> > 2. A Servlet that accepts the URL and logs information. I used log4j
> > so the Java code fit on one screen. I made almost everything
> > configurable from web.xml.
> >
> > solprovider
> >
>
>
>
> --
> Regards,
> Simon