I haven't programmatically configured Log4J as you are doing here, but if you were doing this using the log4j.properties file I would say you are getting output from the root logger as well as your own logger for 'myapp'.
Try setting up a log4j.properties file and don't add the console appender to the root logger, only your own logger that you are defining. Kevin Hooke -----Original Message----- From: Chang, Betty [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 3:09 PM To: Log4J Users List Subject: RE: I cannot figure out where my extra message line comes from onthe console Hi -- I removed my ConsoleAppender, and just call BasicConfigurator() with no parameters, and I STILL get that extra line. Here's the code: import org.apache.log4j.*; public class MyApp { static Logger logger = Logger.getLogger("myapp"); public static void main (String[] args) { BasicConfigurator.configure(); logger.info("here"); } } And, here's the output: - here 0 [main] INFO myapp - here As you can see -- I now have the default format line, but where is that extra first line coming from??? Betty -----Original Message----- From: Paul Smith [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 2:54 PM To: Log4J Users List Subject: Re: I cannot figure out where my extra message line comes from onthe 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]