logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken....@bmwna.com
Subject RE: Log4J Unix file logging problem
Date Thu, 26 Feb 2004 16:05:27 GMT
Looks like your code is working as you said - you create a new file and an
appender...but you never write to it...  :)
 
Can you show us the code that's doing the logging?
 
Ken

-----Original Message-----
From: NGOR Eric [mailto:eric.ngor@infotel.com]
Sent: Thursday, February 26, 2004 5:33 AM
To: log4j-dev@jakarta.apache.org
Subject: Log4J Unix file logging problem



Hello,

I'm trying to log in a file under Linux (I'm the root) using a simple
example.

The problem is that Iog4j effectively creates the file, but doesn't write
into it.

Under windows, I don't have this problem using the same code. (so it's not a
path problem).

Any specific behavior with unix systems?

Here is my code.

Thanks in advance.

Eric.

        private void test() {

                

                WriterAppender writerAppender = new WriterAppender();

                writerAppender.setLayout(new SimpleLayout());

                

                FileOutputStream fos = null;

                OutputStreamWriter osw = null;

                try {

                        fos = new FileOutputStream("/yep.log");

                        osw = new OutputStreamWriter(fos);

                        

                } catch (FileNotFoundException e) {

                        e.printStackTrace();

                }

                writerAppender.setWriter(osw);

                writerAppender.activateOptions();

                

                LogManager.getRootLogger().addAppender(writerAppender);

        }


Mime
View raw message