Discussion:
[Davmail-users] RFC (request for comment) on new connection logging feature
Mickaël Guessant
2017-03-03 00:42:52 UTC
Permalink
Hi all,

I recently added a new logging category in DavMail code to help users
track DavMail usage and maybe also ban IPs after too many failures.

In order to enable this new feature, please checkout latest version and
add the following lines to log4j.properties:

log4j.logger.davmail.connection=DEBUG, ConnectionAppender

log4j.appender.ConnectionAppender=org.apache.log4j.FileAppender
log4j.appender.ConnectionAppender.file=davmailconnection.log
log4j.appender.ConnectionAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.ConnectionAppender.layout.ConversionPattern=%d{ISO8601}
%-5p [%t] %c %x - %m%n

=> you will get a new log file davmailconnection.log with

event (LOGON, FAILED, CONNECT, DISCONNECT)

source IP and port

username for logon events

I would be very interested to get feedback on this before the upcoming
release.

Thanks !
--
Mickael Guessant
mailto:***@free.fr
Geert Stappers
2017-03-12 16:17:34 UTC
Permalink
Post by Mickaël Guessant
Hi all,
I recently added a new logging category in DavMail code to help users
track DavMail usage and maybe also ban IPs after too many failures.
In order to enable this new feature, please checkout latest version and
log4j.logger.davmail.connection=DEBUG, ConnectionAppender
log4j.appender.ConnectionAppender=org.apache.log4j.FileAppender
log4j.appender.ConnectionAppender.file=davmailconnection.log
log4j.appender.ConnectionAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.ConnectionAppender.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c %x - %m%n
=> you will get a new log file davmailconnection.log with
event (LOGON, FAILED, CONNECT, DISCONNECT)
source IP and port
username for logon events
I would be very interested to get feedback on this before the upcoming
release.
Thanks !
I haven't test because I use davmail as a private gateway.

And this posting is still a retransmit of the feedback request.

If it remains clam, just release to get the option to larger audience.



Groeten
Geert Stappers
--
Leven en laten leven
Liam Gretton
2017-03-23 11:09:13 UTC
Permalink
I recently got round to looking at this new feature, it would be very very useful to me.

Unfortunately I can't get it to work. I checked out the code from SVN today (r2475).

Here are my log4j settings in davmail.conf:


# Logging settings
davmail.logFilePath=/var/log/davmail.log
log4j.logger.httpclient.wire=WARN
log4j.logger.org.apache.commons.httpclient=WARN
log4j.rootLogger=WARN
log4j.logger.davmail=DEBUG
log4j.logger.davmail.connection=DEBUG, ConnectionAppender
log4j.appender.ConnectionAppender=org.apache.log4j.FileAppender
log4j.appender.ConnectionAppender.file=/tmp/davmailconnection.log
log4j.appender.ConnectionAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.ConnectionAppender.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c %x - %m%n

The file /tmp/davmailconnection.log is not created automatically, and even if present before starting davmail nothing is written to it during connections. There are no errors reported in the main log file.

Is there something I'm not doing correctly?
--
Liam Gretton ***@le.ac.uk
Systems Specialist http://www.le.ac.uk/its/
IT Services Tel: +44 (0)116 2522254
University Of Leicester, University Road
Leicestershire LE1 7RH, United Kingdom
Mickaël Guessant
2017-03-23 22:43:36 UTC
Permalink
Post by Liam Gretton
I recently got round to looking at this new feature, it would be very very useful to me.
Unfortunately I can't get it to work. I checked out the code from SVN today (r2475).
# Logging settings
davmail.logFilePath=/var/log/davmail.log
log4j.logger.httpclient.wire=WARN
log4j.logger.org.apache.commons.httpclient=WARN
log4j.rootLogger=WARN
log4j.logger.davmail=DEBUG
log4j.logger.davmail.connection=DEBUG, ConnectionAppender
log4j.appender.ConnectionAppender=org.apache.log4j.FileAppender
log4j.appender.ConnectionAppender.file=/tmp/davmailconnection.log
log4j.appender.ConnectionAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.ConnectionAppender.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c %x - %m%n
The file /tmp/davmailconnection.log is not created automatically, and even if present before starting davmail nothing is written to it during connections. There are no errors reported in the main log file.
Is there something I'm not doing correctly?
=> You have to add the above lines directly in log4j.properties before
build, or create a separate log4j.properties and add its path in DavMail
classpath *before* davmail.jar

I may eventually add an option in .davmail.properties to add the
appender automatically, but this is not yet the case.

Regards,
--
Mickael Guessant
mailto:***@free.fr
Liam Gretton
2017-03-24 09:48:00 UTC
Permalink
Post by Mickaël Guessant
=> You have to add the above lines directly in log4j.properties before
build, or create a separate log4j.properties and add its path in DavMail
classpath *before* davmail.jar
Oops, my misunderstanding, apologies.

I'll have a play with 4.8.0 now anyway, thanks for the new release.
--
Liam Gretton ***@le.ac.uk
Systems Specialist http://www.le.ac.uk/its/
IT Services Tel: +44 (0)116 2522254
University Of Leicester, University Road
Leicestershire LE1 7RH, United Kingdom
Loading...