Package com.atlassian.bamboo.filter
Class AccessLogFilter
- java.lang.Object
-
- com.atlassian.bamboo.filter.AccessLogFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public class AccessLogFilter extends Object implements javax.servlet.Filter
Logs JIRA username and request URL via log4j. See http://confluence.atlassian.com/display/JIRA/User+access+logging
-
-
Constructor Summary
Constructors Constructor Description AccessLogFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Does nothingvoiddoFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain chain)Creates logs if INFO logging level is set and URL is "interesting" according toisInterestingUrl(String).protected StringgetEndText(int httpStatusCode, String startText, long memDiff, long timeDiff)protected StringgetStartText(String url, javax.servlet.http.HttpServletRequest request, long startMem)voidinit(javax.servlet.FilterConfig filterConfig)Does nothing but prints INFO log messageprotected booleanisInterestingUrl(String url)Returns true if the given URL is of our interest.static voidsetUsernameLoggingEnabled(boolean value)
-
-
-
Method Detail
-
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletExceptionDoes nothing but prints INFO log message- Specified by:
initin interfacejavax.servlet.Filter- Parameters:
filterConfig- not used- Throws:
javax.servlet.ServletException- not thrown
-
doFilter
public void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletExceptionCreates logs if INFO logging level is set and URL is "interesting" according toisInterestingUrl(String).- Specified by:
doFilterin interfacejavax.servlet.Filter- Parameters:
servletRequest- requestservletResponse- responsechain- filter chain- Throws:
IOException- if another filter in the filter chain throws itjavax.servlet.ServletException- if another filter in the filter chain throws it
-
getStartText
protected String getStartText(String url, javax.servlet.http.HttpServletRequest request, long startMem)
-
getEndText
protected String getEndText(int httpStatusCode, String startText, long memDiff, long timeDiff)
-
isInterestingUrl
protected boolean isInterestingUrl(String url)
Returns true if the given URL is of our interest. Images (.gif, .png, .jpg, .ico), CSS (.css) and JavaScript (.js) are out of interest and if url ends with one of these extentions false is returned.- Parameters:
url- url to check- Returns:
- true if interesting
-
destroy
public void destroy()
Does nothing- Specified by:
destroyin interfacejavax.servlet.Filter
-
setUsernameLoggingEnabled
public static void setUsernameLoggingEnabled(boolean value)
-
-