Well, you probably shouldn't be running BasicConfigurator.configure() multiple times. Do it once. A good place might be a constructor. Try testing after removing the BasicConfigurator line and see what your logging output looks like.

Jake

At 04:26 PM 11/26/2002 +0000, you wrote:
hi All

        I am facing problem when i call logger.info() method
more than one
time in the same class. How i can over come this ?
The problem is the message given to logger.info() is
printing cumulatively
as output shown bellow.

Thanks
Purshi

    import org.apache.log4j.Logger;
    import org.apache.log4j.BasicConfigurator;

    public class Hello {
        private static Logger logger;

      public static void main(String argv[]) {
        logger = Logger.getRootLogger();
        Hello hl = new Hello();
                System.out.println ("In Hello Main 1");
                hl.mainTest();
                System.out.println ("In Hello Main 2");
                hl.mainTest();
                System.out.println ("In Hello Main 3");
                hl.mainTest();
                System.out.println ("In Hello Main 4");
                hl.mainTest();
      }

        public void mainTest() {
                BasicConfigurator.configure();
                String str = "What a beatiful day.";
                logger.info(str);
                str = null;
      }
    }

java Hello

In Hello Main 1
0 [main] INFO root  - What a beatiful day.

In Hello Main 2
20 [main] INFO root  - What a beatiful day.
20 [main] INFO root  - What a beatiful day.

In Hello Main 3
20 [main] INFO root  - What a beatiful day.
20 [main] INFO root  - What a beatiful day.
20 [main] INFO root  - What a beatiful day.

In Hello Main 4
20 [main] INFO root  - What a beatiful day.
20 [main] INFO root  - What a beatiful day.
20 [main] INFO root  - What a beatiful day.
20 [main] INFO root  - What a beatiful day.


________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
       visit http://in.tv.yahoo.com

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

Reply via email to