You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lyallex <ly...@gmail.com> on 2007/07/24 09:54:20 UTC

logging mail session debug

Good Morning

tomcat 5.5.23
java 1.5.0_10
javamail 1.4ea
jaf-1.1

I have two classes

foo.MailQueueWatcher extends TimerTask
foo.MailServer

I have the following logging config in ${catalina.home}/conf/logging.properties

foo.MailQueueWatcher.level=ALL
foo.MailQueueWatcher.handlers=2myapp.org.apache.juli.FileHandler
...
2myapp.org.apache.juli.FileHandler.level = FINE
2myapp.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2myapp.org.apache.juli.FileHandler.prefix = mailer

I don't really understand the Tomcat/juli documentation but this works
by trial and error and writes all logging output
from the MailQueueWatcher to ${catalina.base}/logs/mailer...log as expected.

I have configured the logger in MailServer to write to the watcher log

class MailServer {
   ...
   Logger logger = Logger.getLogger("foo.MailQueueWatcher");

   //the following code in this class writes to
${catalina.base}/logs/mailer...log (same as above)

   logger.log(Level.WARNING, this.getClass().getName() + "Logging output");

   //I have the following code in my sendMail method
   ...
   Session session = Session.getInstance(properties);
   session.setDebug(true);
   ...
}

what I am trying to do is send the session debug output to the watcher log
at the moment it goes to System.out. I have tried all sorts of things
with streams but what I really
want to do is stream this data as it is made available into the log file.
I suppose I was was hoping to be able to do something like this
session.setDebugOut(new PrintStream(...get some stream into the logger, true));

I'm sure there is a simple answer to this (or maybe not) but I just
can't see it...

any help/pointers to documentation/archived postings etc much appreciated.

Rgds
Duncan

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org