I cannot figure out where my extra message line comes from on the console

2003-11-12 Thread Chang, Betty
Hi all--  (I'm a new user, so please forgive).

 

Here's my simple program:

 

--

 

import org.apache.log4j.*;

 

public class MyApp

{

static Logger logger = Logger.getLogger(myapp);

public static void main (String[] args)

{

PatternLayout pl = new PatternLayout(%-5p %d
%m%n);

ConsoleAppender cappnd = new
ConsoleAppender(pl);

BasicConfigurator.configure(cappnd);




logger.info(here);

}

}

 

And here's my output :

 

 - here

INFO  2003-11-12 14:38:53,530 here

 

I cannot figure where the extra line with - here  on my console comes
from.

I must be doing something silly.  

 

Thanks

 

Betty

 

 

 

 



Re: I cannot figure out where my extra message line comes from on the console

2003-11-12 Thread Paul Smith
The BasicConfigurator already creates and configures a ConsoleAppender
automatically, so the other one that you are adding is doubling up. (The
output with the time is your appender is your one I think).

cheers,

Paul

On Thu, 2003-11-13 at 09:40, Chang, Betty wrote:
 Hi all--  (I'm a new user, so please forgive).
 
  
 
 Here's my simple program:
 
  
 
 --
 
  
 
 import org.apache.log4j.*;
 
  
 
 public class MyApp
 
 {
 
 static Logger logger = Logger.getLogger(myapp);
 
 public static void main (String[] args)
 
 {
 
 PatternLayout pl = new PatternLayout(%-5p %d
 %m%n);
 
 ConsoleAppender cappnd = new
 ConsoleAppender(pl);
 
 BasicConfigurator.configure(cappnd);
 
 
 
 
 logger.info(here);
 
 }
 
 }
 
  
 
 And here's my output :
 
  
 
  - here
 
 INFO  2003-11-12 14:38:53,530 here
 
  
 
 I cannot figure where the extra line with - here  on my console comes
 from.
 
 I must be doing something silly.  
 
  
 
 Thanks
 
  
 
 Betty
 
  
 
 
 
 
 
 
 


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



RE: I cannot figure out where my extra message line comes from on the console

2003-11-12 Thread Ken . Liu
Paul -

Are you sure about that?  I thought that only happened with
BasicConfigurator.configure() (no params).

  /**
 Add codeappender/code to the root category.
 @param appender The appender to add to the root category.
  */
  static
  public
  void configure(Appender appender) {
Logger root = Logger.getRootLogger();
root.addAppender(appender);
  }


Maybe she is picking up a log4j config file from the classpath?

Ken
  



 -Original Message-
 From: Paul Smith [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 12, 2003 5:54 PM
 To: Log4J Users List
 Subject: Re: I cannot figure out where my extra message line 
 comes from
 on the console
 
 
 The BasicConfigurator already creates and configures a ConsoleAppender
 automatically, so the other one that you are adding is 
 doubling up. (The
 output with the time is your appender is your one I think).
 
 cheers,
 
 Paul
 
 On Thu, 2003-11-13 at 09:40, Chang, Betty wrote:
  Hi all--  (I'm a new user, so please forgive).
  
   
  
  Here's my simple program:
  
   
  
  --
  
   
  
  import org.apache.log4j.*;
  
   
  
  public class MyApp
  
  {
  
  static Logger logger = Logger.getLogger(myapp);
  
  public static void main (String[] args)
  
  {
  
  PatternLayout pl = new 
 PatternLayout(%-5p %d
  %m%n);
  
  ConsoleAppender cappnd = new
  ConsoleAppender(pl);
  
  BasicConfigurator.configure(cappnd);
  
  
  
  
  logger.info(here);
  
  }
  
  }
  
   
  
  And here's my output :
  
   
  
   - here
  
  INFO  2003-11-12 14:38:53,530 here
  
   
  
  I cannot figure where the extra line with - here  on my 
 console comes
  from.
  
  I must be doing something silly.  
  
   
  
  Thanks
  
   
  
  Betty
  
   
  
  
  
  
  
  
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

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



RE: I cannot figure out where my extra message line comes from on the console

2003-11-12 Thread Chang, Betty
Hi -- If I'm picking up some kind of default config file,   what would
it be called?

Thanks

Betty


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 12, 2003 3:01 PM
To: [EMAIL PROTECTED]
Subject: RE: I cannot figure out where my extra message line comes from
on the console

Paul -

Are you sure about that?  I thought that only happened with
BasicConfigurator.configure() (no params).

  /**
 Add codeappender/code to the root category.
 @param appender The appender to add to the root category.
  */
  static
  public
  void configure(Appender appender) {
Logger root = Logger.getRootLogger();
root.addAppender(appender);
  }


Maybe she is picking up a log4j config file from the classpath?

Ken
  



 -Original Message-
 From: Paul Smith [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 12, 2003 5:54 PM
 To: Log4J Users List
 Subject: Re: I cannot figure out where my extra message line 
 comes from
 on the console
 
 
 The BasicConfigurator already creates and configures a ConsoleAppender
 automatically, so the other one that you are adding is 
 doubling up. (The
 output with the time is your appender is your one I think).
 
 cheers,
 
 Paul
 
 On Thu, 2003-11-13 at 09:40, Chang, Betty wrote:
  Hi all--  (I'm a new user, so please forgive).
  
   
  
  Here's my simple program:
  
   
  
  --
  
   
  
  import org.apache.log4j.*;
  
   
  
  public class MyApp
  
  {
  
  static Logger logger = Logger.getLogger(myapp);
  
  public static void main (String[] args)
  
  {
  
  PatternLayout pl = new 
 PatternLayout(%-5p %d
  %m%n);
  
  ConsoleAppender cappnd = new
  ConsoleAppender(pl);
  
  BasicConfigurator.configure(cappnd);
  
  
  
  
  logger.info(here);
  
  }
  
  }
  
   
  
  And here's my output :
  
   
  
   - here
  
  INFO  2003-11-12 14:38:53,530 here
  
   
  
  I cannot figure where the extra line with - here  on my 
 console comes
  from.
  
  I must be doing something silly.  
  
   
  
  Thanks
  
   
  
  Betty
  
   
  
  
  
  
  
  
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

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

 

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



RE: I cannot figure out where my extra message line comes from on the console

2003-11-12 Thread Paul Smith
On Thu, 2003-11-13 at 10:00, [EMAIL PROTECTED] wrote:
 Paul -
 
 Are you sure about that?  I thought that only happened with
 BasicConfigurator.configure() (no params).
 
   /**
  Add codeappender/code to the root category.
  @param appender The appender to add to the root category.
   */
   static
   public
   void configure(Appender appender) {
 Logger root = Logger.getRootLogger();
 root.addAppender(appender);
   }
 
 
 Maybe she is picking up a log4j config file from the classpath?

Ken, you're 100% correct, I miss-read her code.

Betty, I would suggest commenting out all the lines except the
logger.info.  What you should see is a warning about no appenders being
found, but if you get output, then something else is configuring Log4j. 
If this is the case, try adding -Dlog4j.debug=true to the command line
as you run your code, this should output info on what config file it is
picking up.

cheers,

Paul


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



RE: I cannot figure out where my extra message line comes from on the console

2003-11-12 Thread Paul Smith
log4j.properties or log4j.xml,  somewhere in the classpath.

Paul

On Thu, 2003-11-13 at 10:10, Chang, Betty wrote:
 Hi -- If I'm picking up some kind of default config file,   what would
 it be called?
 
 Thanks
 
 Betty
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, November 12, 2003 3:01 PM
 To: [EMAIL PROTECTED]
 Subject: RE: I cannot figure out where my extra message line comes from
 on the console
 
 Paul -
 
 Are you sure about that?  I thought that only happened with
 BasicConfigurator.configure() (no params).
 
   /**
  Add codeappender/code to the root category.
  @param appender The appender to add to the root category.
   */
   static
   public
   void configure(Appender appender) {
 Logger root = Logger.getRootLogger();
 root.addAppender(appender);
   }
 
 
 Maybe she is picking up a log4j config file from the classpath?
 
 Ken
   
 
 
 
  -Original Message-
  From: Paul Smith [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, November 12, 2003 5:54 PM
  To: Log4J Users List
  Subject: Re: I cannot figure out where my extra message line 
  comes from
  on the console
  
  
  The BasicConfigurator already creates and configures a ConsoleAppender
  automatically, so the other one that you are adding is 
  doubling up. (The
  output with the time is your appender is your one I think).
  
  cheers,
  
  Paul
  
  On Thu, 2003-11-13 at 09:40, Chang, Betty wrote:
   Hi all--  (I'm a new user, so please forgive).
   

   
   Here's my simple program:
   

   
   --
   

   
   import org.apache.log4j.*;
   

   
   public class MyApp
   
   {
   
   static Logger logger = Logger.getLogger(myapp);
   
   public static void main (String[] args)
   
   {
   
   PatternLayout pl = new 
  PatternLayout(%-5p %d
   %m%n);
   
   ConsoleAppender cappnd = new
   ConsoleAppender(pl);
   
   BasicConfigurator.configure(cappnd);
   
   
   
   
   logger.info(here);
   
   }
   
   }
   

   
   And here's my output :
   

   
- here
   
   INFO  2003-11-12 14:38:53,530 here
   

   
   I cannot figure where the extra line with - here  on my 
  console comes
   from.
   
   I must be doing something silly.  
   

   
   Thanks
   

   
   Betty
   

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


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