On Sat, Sep 5, 2009 at 8:22 PM, Norman Maurer<[email protected]> wrote:
> +1,
>
> this makes sense.  I would even like to eliminate the whole "extends
> AbstractLogEnabled" stuff. I think there is no need to extend a class
> just to be able to log..

+1

after exploring a few different options in IMAP, i found that context
sensitive logging was the best replacement. i'd be very happy switch
all james servers to this paradigm.

with the IMAP server, the prefix is based on the handler for the
request[1]. IMAP has long running conversations so this allows each
conversation to be isolated just by using a simple grep. the start of
the conversation provides information about the session so i don't
bother prefixing with a session. most IMAP clients run many
connections in parrallel so i found it very difficult to debug without
being able to isolate a conversation.

AIUI SMTP has shorter running conversations so perhaps may need to
consider prefixing with some session information as well (but not sure
what, exactly)

- robert

[1] logging sample
04/09/09 08:08:09 DEBUG imapserver: Retrieving a
org.apache.james.socket.DelegatingJamesHandler from the pool
04/09/09 08:08:09 DEBUG imapserver: Handler [Handler-2] obtained from pool.
04/09/09 08:08:09 DEBUG imapserver: Retrieving a
org.apache.james.socket.DelegatingJamesHandler from the pool
04/09/09 08:08:09 DEBUG imapserver: Handler [Handler-4] obtained from pool.
04/09/09 08:08:09 INFO  imapserver: [Handler-2]Connection from
akrotiri. (10.0.0.27)
04/09/09 08:08:09 DEBUG imapserver: Connection from akrotiri.
(10.0.0.27) opened.
04/09/09 08:08:09 INFO  imapserver: [Handler-4]Connection from
akrotiri. (10.0.0.27)
04/09/09 08:08:09 DEBUG imapserver: Connection from akrotiri.
(10.0.0.27) opened.
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Calling start()
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Watchdog on thread
'default Worker #15' has time to sleep 1800000
04/09/09 08:08:12 DEBUG imapserver: [Handler-4] Calling start()
04/09/09 08:08:12 DEBUG imapserver: [Handler-4] Watchdog on thread
'default Worker #7' has time to sleep 1800000
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Got <tag>: 1
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Got <command>: capability
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] No mailbox selected
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Calling reset() on
thread 'default Worker #15'
04/09/09 08:08:12 DEBUG imapserver: [Handler-4] Got <tag>: 1
04/09/09 08:08:12 DEBUG imapserver: [Handler-4] Got <command>: capability
04/09/09 08:08:12 DEBUG imapserver: [Handler-4] No mailbox selected
04/09/09 08:08:12 DEBUG imapserver: [Handler-4] Calling reset() on
thread 'default Worker #7'
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Got <tag>: 2
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Got <command>: login
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] INBOX exists. No need
to create it.
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Calling reset() on
thread 'default Worker #15'
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Got <tag>: 3
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Got <command>: namespace
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] No mailbox selected
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Calling reset() on
thread 'default Worker #15'
04/09/09 08:08:12 DEBUG imapserver: [Handler-4] Got <tag>: 2
04/09/09 08:08:12 DEBUG imapserver: [Handler-4] Got <command>: logout
04/09/09 08:08:12 DEBUG imapserver: [Handler-4] Calling stop() on
thread 'default Worker #7'
04/09/09 08:08:12 INFO  imapserver: Connection from akrotiri.
(10.0.0.27) closed.
04/09/09 08:08:12 DEBUG imapserver: [Handler-4] Closing socket
04/09/09 08:08:12 DEBUG imapserver: [Handler-4] Calling
disposeWatchdog() on thread 'default Worker #7'
04/09/09 08:08:12 DEBUG imapserver: Returning Handler [Handler-4] to pool.
04/09/09 08:08:12 DEBUG imapserver: Returning a
org.apache.james.socket.DelegatingJamesHandler to the pool
04/09/09 08:08:12 DEBUG imapserver: [null] Watchdog on thread 'default
Worker #7' is exiting run().
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Got <tag>: 4
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Got <command>: list
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Calling reset() on
thread 'default Worker #15'
04/09/09 08:08:12 DEBUG imapserver: [Handler-2] Got <tag>: 5

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to