Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Creation FilterLogger

Thibaut Wavreille March 23, 2014

Hi,

I'd like to know how can I create my own logger filter (regarding to AccessLogFilter).

So I created ajava class AdminActivitiesLogFilter who implements filter (with all methods that I need).

Then, I updated the web.xml with this :

<filter>

<filter-name>AdminActivitiesLogFilter</filter-name>

<filter-class>...AdminActivitiesLogFilter</filter-class>

</filter>

Also the log4j.properties:

log4j.category.....AdminActivitiesLogFilter=INFO, accesslog

log4j.additivity.....AdminActivitiesLogFilter=false

I added the jar into the WEB-INF/lib

But I saw nothing in my log file.

Could you help me please ?

5 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Steve Gerstner [bridgingIT]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 23, 2014

You need to name the appender accesslog or use log4j.category.....AdminActivitiesLogFilter=INFO, jaspersAccessLog

to write to your log. At the moment you have the problem that confluence did not know where to log. Regards Steve

0 votes
Thibaut Wavreille March 23, 2014

Maybe I've to add this in my code :

PropertyConfigurator.configure("log4j.properties");

to load properties of log4j.

0 votes
Thibaut Wavreille March 23, 2014

I don't have any appender for accesslog because I'm using a custom:

log4j.appender.jaspersAccessLog=org.apache.log4j.RollingFileAppender

log4j.appender.jaspersAccessLog.Threshold=DEBUG

log4j.appender.jaspersAccessLog.File=${catalina.home}/logs/atlassian-confluence-jaspers-access.log

log4j.appender.jaspersAccessLog.MaxFileSize=20480KB

log4j.appender.jaspersAccessLog.MaxBackupIndex=5

0 votes
Thibaut Wavreille March 23, 2014

Hi Steve,

Thank you for your answer. I've already a filter mapping in the web.xml in installation directory of Confluence.

But the following lines don't seem to work correctly:

log4j.category.....AdminActivitiesLogFilter=INFO, accesslog

log4j.additivity.....AdminActivitiesLogFilter=false

It writes nothing in mon log file.

I'll test the other method in your link.

Steve Gerstner [bridgingIT]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 23, 2014

have you defined an appender for accesslog like log4j.appender.accesslog.*?

0 votes
Steve Gerstner [bridgingIT]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 23, 2014

Try a filter module in a plugin:

https://developer.atlassian.com/display/DOCS/Servlet+Filter+Plugin+Module

This should work.

If you want to do it your way, you will need at least a filter-mapping in your web.xml ;)

Regards

Steve

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events