audit4j / audit4j-core

An open source auditing framework.
http://audit4j.org
Apache License 2.0
125 stars 77 forks source link

Problems setting up Audit4j in Servlet Spec 3.x #14

Closed theborakompanioni closed 8 years ago

theborakompanioni commented 8 years ago

Setting up Audit4j (v2.3.1) in a Servlet Sepc 3.x can be quite tricky. Now I see that you have "removed support" for it.. de72070709b937de534f13cb269490da457e9881. Can we have insight into the motivation behind this move?

Also: If no "handlers" are found the AuditManager is started with a path taken from context.getRealPath("/WEB-INF/classes") and afterwards checked if it is a file with AuditUtil.isFileExists(configFilePath) which always leads to an InitializationException.

Currently, I am working around this by setting init parameters in my initializer like this:

        servletContext.setInitParameter("handlers", "org.audit4j.core.handler.ConsoleAuditHandler");
        servletContext.setInitParameter("layout", "org.audit4j.core.layout.SimpleLayout");
        servletContext.setInitParameter("metaData", "org.audit4j.core.DummyMetaData");

This is not the way I had anticipated my config to look like. Can you guide the way to a proper solution?

janithb commented 8 years ago

Hi @theborakompanioni

We have recently moved Servlet Sepc 3.x config support to audit4j-http-app plugin. I will push the sources later.

There was a conflict between servlet spec 3 config support and other injecting configurations (Spring, cdi, etc).

We have already identified that scanning /WEB-INF/classes and getting initialization exception path in Servlet spec 3 is a bug. It will be fixed in 2.4.x release.

You can still want to use the servlet spec 2 config support please use http-app plugin.

please use audit4j 2.4.0-alpha1 for testing.