This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Pipe JavaMail Debug information to Log4J? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Pipe JavaMail Debug information to Log4J?" Watch "Pipe JavaMail Debug information to Log4J?" New topic
Author

Pipe JavaMail Debug information to Log4J?

Pete Neu
Ranch Hand

Joined: Feb 18, 2005
Posts: 86
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

Joined: Feb 18, 2005
Posts: 86
Nodoby any idea how this is done?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi Pete,

How is Javamail returning debug information to you?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Pete Neu
Ranch Hand

Joined: Feb 18, 2005
Posts: 86
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

Joined: Jun 24, 2003
Posts: 3274
    
    5

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

Joined: Feb 18, 2005
Posts: 86
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Pipe JavaMail Debug information to Log4J?