How can I get log4j to write to standard out?

I can't seem to find the proper FileOutputStream Class to initiate the WriterAppender 
that would display to the screen.

Sorry that this is such a basic Java lang question. Below is the Hello World program 
that I have working.

TIA,
MPC

public class TestLogger {
        static Logger myLogger = Logger.getLogger("TestLogger");
        
        public static void main(String[] args) {
                File myFile = null; 
                FileOutputStream myFileOS = null;
                PatternLayout myLayout = null;
                WriterAppender myAppender = null;
                
                System.out.println("Writing to file...");
                try {
                    myFile = new File("foo.out");
                        myFileOS = new FileOutputStream (myFile);
                }catch (Exception e) {
                        System.out.println(e.toString());
                }
                myLayout = new PatternLayout("%m%n");
                myAppender = new WriterAppender(myLayout, myFileOS);
                myLogger.addAppender(myAppender);
                myLogger.setLevel(Level.DEBUG);
                myLogger.debug("Hello World with a patternLayout");
        }
} 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to