We were trying to create access logs for our web application. Currently we are using the Spring Security 3 for authentication & authorization. We were able to get the DEBUG logs entries for all activities in the spring security framework. But, we want to generate logs which would allow us to view LogIn , Logout, Access Denied, entries customized for our needs. Also, we want the Log level to be INFO and not DEBUG for performance reasons. Is there any way we can do that in Spring? I was thinking of adding another Filter which would be invoked by the spring secirity filters after processing the request...But I am not sure if that is possible.
If anyone has already tried something similar, please help us with this.
You probably want to look into hooking into the authentication events published by the framework, which uses the standard Spring ApplicationListener functionality. The Spr Sec framework ships with "LoggerListener", which should provide you with an example of how to use these. Refer to the Javadoc for the relevant classes here.
Author, Spring Security 3 (the Book), Packt Publishing, 2010
I see using logger listener we can log events such as Authentication Credentials Not Found, Authorization Failure and Authorized . but how can i log logout event?? is there any other way like logger listener.? or do i have to implement custom logout Filter??
subject: Customize logs for access with Spring Security