Hi,
I need to add some more. If I append(I was over writing) the log
messages to the file it works, but output of first call will be printing
once, 2nd call will print twice, 3rd thrice...like that. Anybody have a
remedy to this please...? My out look like this.
0 2001-07-26 13:19:22,632 [main]ERROR Logger .class - 1Log message from the
writeLogFile fn.
50 2001-07-26 13:19:22,682 [main]INFO Logger .class - 2Log message from
the writeLogFile fn.
50 2001-07-26 13:19:22,682 [main]INFO Logger .class - 2Log message from
the writeLogFile fn.
50 2001-07-26 13:19:22,682 [main]DEBUG Logger .class - 3Log message from
the writeLogFile fn.
50 2001-07-26 13:19:22,682 [main]DEBUG Logger .class - 3Log message from
the writeLogFile fn.
50 2001-07-26 13:19:22,682 [main]DEBUG Logger .class - 3Log message from
the writeLogFile fn.
50 2001-07-26 13:19:22,682 [main]WARN Logger .class - 4Log message from
the writeLogFile fn.
50 2001-07-26 13:19:22,682 [main]WARN Logger .class - 4Log message from
the writeLogFile fn.
50 2001-07-26 13:19:22,682 [main]WARN Logger .class - 4Log message from
the writeLogFile fn.
50 2001-07-26 13:19:22,682 [main]WARN Logger .class - 4Log message from
the writeLogFile fn.
----------------------------------------------------------------------------
-------------------------
Hi there,
I have a function writeLogMsg(priority,msg), which uses a WriterAppender to
write the msg. to a file. My problem is if I call this fn. say 4 times with
different priority and message, the fourth one will be prining 4 times. I
miss the output of first 3 fn. calls.here is the code. Any kind of
suggestions are appreciated.
thanx,
mathew.
public void writeLogFile(Priority P, String logMsg) {
try{
File f = new File("c:\logfile.log"); // getLogFile();
FileOutputStream out= new FileOutputStream(f);
Category root = Category.getRoot();
Layout layout = new PatternLayout("%r %d [%t]%-5p %c %x - %m%n");
root.addAppender(new WriterAppender(layout,out));
cat.log(P,logMsg);
} catch(Exception e)
{ System.out.println(" Exception is caught in writeLogFile method"); } }
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]