[Yanel-dev] Re: [Yanel-commits] rev 45913
- public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet
Guillaume Déflache
guillaume.deflache at wyona.com
Tue Dec 8 17:45:37 CET 2009
Hi!
michi at wyona.com schrieb:
> Author: michi
> Date: 2009-12-08 16:25:32 +0100 (Tue, 08 Dec 2009)
> New Revision: 45913
>
> Modified:
> public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
> Log:
> log referer if 404
>
> Modified: public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
> ===================================================================
> --- public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java 2009-12-08 15:12:17 UTC (rev 45912)
> +++ public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java 2009-12-08 15:25:32 UTC (rev 45913)
> @@ -2084,7 +2084,8 @@
> *
> */
> private void do404(HttpServletRequest request, HttpServletResponse response, Document doc, String exceptionMessage) throws ServletException {
> - log404.info(request.getRequestURL().toString());
> + log404.info("Referer: " + request.getHeader("referer"));
> + log404.warn(request.getRequestURL().toString());
> //org.wyona.yarep.core.Node node = realm.getRepository().getNode("/yanel-logs/404.txt");
>
> String message = "No such node/resource exception: " + exceptionMessage;
>
We should avoid logging one event in two steps, because with concurrent
requests there is no guarantee that the INFO and WARN lines will be
contiguous.
(Also having single-line-based logs help when working with basic Unix
tools.)
Also thanks to these and previous changes it looks like you fixed
http://bugzilla.wyona.com/cgi-bin/bugzilla/show_bug.cgi?id=4767 would
you mind updating it accordingly?
As a closing remark, maybe for all kinds of request-related logging
messages (not only 404), we should use consistent and standard formats:
maybe using
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/or/ObjectRenderer.html
would help.
Cheers,
Guillaume
More information about the Yanel-development
mailing list