Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pipe JavaMail Debug information to Log4J?

 
Pete Neu
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to pass the debug information JavaMail gives me to my Log4J log file. I have set up a Log4J configuration but I don't know how to pipe the JavaMail debug output into it.

Any help much appreciated.

Cheers,
Pete
 
Pete Neu
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nodoby any idea how this is done?
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pete,

How is Javamail returning debug information to you?
 
Pete Neu
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Martijn,

JavaMail is writing directly to the stdout. Configuration for debug info looks like this:

Session session = Session.getInstance(props, null); session.setDebug(true);

Cheers,
Pete
[ November 20, 2008: Message edited by: Pete Neu ]
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I _think_ there's a method to tell the debug to write to an alternative PrintStream instead of Stdout? You might be able to capture that?
 
Pete Neu
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the problem. JavaMail seems to be structured very simplistic in terms of debugging. I couldn't find a way to send the debug informations to a file because it gets written directly to the console there seems to be no method to alter this behavior.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic