tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject Re: Need help on Custom Accesslog
Date Sat, 02 May 2009 11:44:56 GMT
On 01.05.2009 22:55, Vijay wrote:
> Hi,
> I wanted to send a application message like "Application specific GUID" to
> the accesslogs, the GUID is generated by our system and it is not general or
> available in the request or the response.... So i was wondering if there is
> any way where we can send that message to the logger which will add it to
> the Access log when it is logging the request?
> The problem is that i am writing a parser to view the logs using chukwa, now
> if i dont have this functionality, hence timing of the logging is an
> issue(In case I do it seperatly in a diffrent log file).... I might need to
> wait longer to parse it.

The access log allows you to log session and request attributes via an
appropriate configuration of the pattern attribute:

%{xxx}r xxx is an attribute in the ServletRequest
%{xxx}s xxx is an attribute in the HttpSession

So you can either set the GUID as an attribute to the request object via
setAttribute, or put it to the session. I guess your GUID is request
specific, so you should use the request way of doing it. Choose an
appropriate name, that does not conflict with any other possible use,
like "com.mycompany.myapp.GUID" for the attribute (that's the xxx above).

Note: setting a request attribute has nothing to do with request headers
or query parameters. Those attributes are neither received from the
client, nor send to it. They are for internal processing means.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message