Read:

http://jakarta.apache.org/log4j/docs/TROUBLESHOOT.html#duplicates

At 14:14 12.04.2001 +0530, you wrote:
>Hi,
> 
>I am new to Log4J, I am facing a problem, please help me.
> 
>I am developing a logging system for my application
>Basically I providing an interface which logs mesages from the application to 
>different files.
>I am using Log4J version 0.9.0 internally.
> 
>I am using  FileAppender with  PatternLayout and logging with warn(), info(), debug() 
>and error();
> 
> 
>Here is the code that i am using.
> 
> 
> FileAppender fileAppender=null;
> Category  popCategory=Category.getInstance("POP");
> String strLogPath = "C:\pop.log"
>  
>  try
>  {
>   fileAppender= new FileAppender(new PatternLayout("%d{yyyy:MM:dd HH:mm:sss} %c 
>[%-5p] : %m%n"),strLogPath);
>   popCategory.addAppender(fileAppender);
>  }
>  catch (IOException ioe)
>  {
>   System.out.println("Catched Io Exception"+ioe.toString());
>  }
>then following method is being called repeatedly in a loop 
> 
> public synchronized void  writeLog(,String message)
> { 
>   popCategory.warn(message);
>   System.out.println("POP   :"+message);
>  }
> 
>Now the problem is, each logging request to this mehtod is logging the corresponding 
>message multiple times in the log file 
>where as the corresponding System.Out.println() prints it only once per request on 
>the console.
>In the log file the messages are being written twice, trice,four times,five times and 
>so on.......
>The code above is the only code related to logging.
> 
>Can anybody tell me the reason behind this or Has anybody experienced the same 
>problem.
>Please help me.
> 
> 
>Thanks in advance
>Rupesh
> 
> 
> 
>
>----------------------------------------------------------------------------------------------------------
>"Here is a simple test to find out whether your mission on earth has
> finished,
>        If you are alive ,it isn't"
>
>--------------------------------------------------------------
>QuantumLink Communications, Bombay, India

--
Ceki Gülcü     Web: http://qos.ch 
email: [EMAIL PROTECTED] or [EMAIL PROTECTED]


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

Reply via email to