[Yanel-dev] Access logging

Cedric Staub cedric.staub at wyona.com
Thu Sep 2 09:57:32 CEST 2010


Hello

I recently had a conversation where, in the context of access logging,
the following idea came up: what if a resource wants to append
additional information to the access log, e.g. for auditing?

Imagine the following scenario: you have a resource which can display
assets from various sources. From the information in the access log you
can't infer which source a request accessed. Now we'd like to append a
new field, say "source", to the access log containing that information.
That means, the resource should have a way of appending arbitrary
additional fields to the access log.

I suppose this should be as generic as possible, so:

1. I would add a new private variable of type Map<String, String> to the
Resource class, including a function appendFieldToAccessLog. This makes
it possible for all resources to append additional info to the access
log by simply calling that function. Also include a getter method.

2. In YanelServlet, extend the function doLogAccess so that it reads the
variables from the resource and appends them to the access log.

This way, a resource can just call appendFieldToAccessLog in order to
add additional information to the access log, and Yanel will take care
of it. This seems like the simplest solution to me, but I'm open to ideas.
Nevertheless, I will start working on a proof-of-concept patch shortly.

Feedback is very welcome!

Cheers
Cedric


More information about the Yanel-development mailing list