You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vijay <vi...@gmail.com> on 2009/05/01 22:55:39 UTC

Need help on Custom Accesslog

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.

Thanks for the Help!

Regards,
</VJ>

Re: Need help on Custom Accesslog

Posted by Vijay <vi...@gmail.com>.
Thanks a lot Rainer, That helps....
Regards,
</VJ>




On Sat, May 2, 2009 at 4:44 AM, Rainer Jung <ra...@kippdata.de> wrote:

>  neither received from the
> client, nor send to it. They are for internal processing means.
>

Re: Need help on Custom Accesslog

Posted by Rainer Jung <ra...@kippdata.de>.
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.

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org