This package provides support for easy logging of user accesses (visits) in Tapestry 5 applications. It provides out-of-the-box logging using SFL4J and the standard output.
A logger is a class that implements AccessLogger.
For each request that must be logged, Tapestry Access Logger
invokes its void log(Access access) method.
Access is a class provided by this package
to represent one user access (visit).
Access properties:
jsessionid valueUser-Agent HTTP header. It indicates
the browser used by the visitor.
User
that made the request or null
if the user was not logged. This class comes
from the
Generic Authentication package.
Tapestry Access Logger-Hibernate provides user access logging to almost any database using Hibernate.
Loggers are added to the AccessLoggerHub
service. This is done adding a method in your application's
AppModule class. Example using the
Slf4JAccessLogger:
public void contributeAccessLoggerHub(OrderedConfiguration<AccessLogger> configuration) {
AccessLogger logger = new Slf4JAccessLogger();
configuration.add("slf4j", logger);
}
By default, only page requests are logged.
If you want to change this behaviour, create
an AccessFilterRule. Its only method,
Boolean accept(String path),
must return true if the request to that path
must be logged, false if the request must not
be logged, and null to allow other
rules to decide.
To add your custom filter rule, contribute it to the
AccessFilter service in your application
AppModule. Example using the
URLEndingAccessFilterRule to
log all requests to JAR files:
public void contributeAccessFilter(OrderedConfiguration<AccessFilterRule> rules) {
AccessFilterRule rule = new URLEndingAccessFilterRule(".jar");
rules.add("jar", rule);
}