Session setDebugOut Example

Session class getDebug example. This example shows you how to use setDebugOut method.


Session class setDebugOut example.public void setDebugOut(PrintStream out) Set the stream to be used for debugging output for this session. If out is null, System.out will be used. Note that debugging output that occurs before any session is created, as a result of setting the mail.debug system property, will always be sent to System.out.

Here is the code
/*
 * @ # GetDebugOut.java
 * A class repersenting use to getDebugOut method 
 * of Session class in javax.mail package
 * version 05 July 2008
 * author Rose India 
 */
package session;

import java.io.*;
import java.util.*;
import javax.mail.*;

public class GetDebugOut {

    public static void main(String args[]) throws Exception {

        Properties properties = System.getProperties();

        Session session = Session.getDefaultInstance(properties);

        PrintStream printStream = session.getDebugOut();
        printStream.print("Hi.... This is komal");

        printStream.close();
    }
}

Hi.... This is komal

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US