[appengine-java] Re: Extra log output

2009-09-23 Thread Toby Reyelts
You're using java.util.logging, not log4j. What does your logging.properties
file look like?

On Wed, Sep 23, 2009 at 5:02 PM, Pion onlee2...@gmail.com wrote:


 I have the following code snippet:

 public class FooServiceImpl extends RemoteServiceServlet implements
 ControllerInputService {

@Override
 public String bar(String input) {
  ...
  logger.debug(Entering ... bar());
 ...
 }

private static final Logger logger = Logger.getLogger
 (FooServiceImpl .class.getName());
 } // FooServiceImpl

 It prints out the following messages:

 0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - Entering ... bar()
 0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - Entering ... bar()
 0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - Entering ... bar()

 Notice that it prints out more than 1 time. I double/triple checked
 that I only call the bar() method once.

 Then, I modified the code as the following:

 public class FooServiceImpl extends RemoteServiceServlet implements
 ControllerInputService {

@Override
 public String bar(String input) {
  ...
  counter++;
  logger.debug(counter +  Entering ... bar());
  System.out.println(counter +  Entering ... bar() from
 System.out.println());
 ...
 }

private int counter = 0;

private static final Logger logger = Logger.getLogger
 (FooServiceImpl .class.getName());
 } // FooServiceImpl

 It produces the following output:

 0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - 1 Entering ... bar
 ()
 0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - 1 Entering ... bar
 ()
 0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - 1 Entering ... bar
 ()
 1 Entering ... bar() from System.out.println()

 Notice that there are still several log outputs (not as expected - I
 only expect only 1 output) but only one output from System.out.println
 () (as expected) and the counter is still 1 (as expected).

 My log4j.properties

 # A default log4j configuration for log4j users.
 #
 # To use this configuration, deploy it into your application's WEB-INF/
 classes
 # directory.  You are also encouraged to edit it as you like.

 # Configure the console as our one appender
 log4j.appender.A1=org.apache.log4j.ConsoleAppender
 log4j.appender.A1.layout=org.apache.log4j.PatternLayout
 log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c]
 - %m%n

 My environtments: GAE 1.2.5, GWT 1.7, Eclipse-Galileo on Windows
 Vista.

 Why do I have several log output?

 Thanks in advance for your help.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Extra log output

2009-09-23 Thread Pion

Thanks for your reply, Toby.

I am using log4j because I want to be consistent with some existing
modules/classes. I did the following:

  import org.apache.log4j.Logger;

I just saw http://logging.apache.org/log4j/1.2/faq.html#duplicate-messages.
log4j call is cumulative/additive. I called the
BasicConfigurator.configure(); methods more than once. Now it is
fixed.

Again, thanks.

On Sep 23, 2:20 pm, Toby Reyelts to...@google.com wrote:
 You're using java.util.logging, not log4j. What does your logging.properties
 file look like?

 On Wed, Sep 23, 2009 at 5:02 PM, Pion onlee2...@gmail.com wrote:

  I have the following code snippet:

  public class FooServiceImpl extends RemoteServiceServlet implements
  ControllerInputService {

        �...@override
      public String bar(String input) {
           ...
           logger.debug(Entering ... bar());
          ...
      }

         private static final Logger logger = Logger.getLogger
  (FooServiceImpl .class.getName());
  } // FooServiceImpl

  It prints out the following messages:

  0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - Entering ... bar()
  0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - Entering ... bar()
  0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - Entering ... bar()

  Notice that it prints out more than 1 time. I double/triple checked
  that I only call the bar() method once.

  Then, I modified the code as the following:

  public class FooServiceImpl extends RemoteServiceServlet implements
  ControllerInputService {

        �...@override
      public String bar(String input) {
           ...
           counter++;
           logger.debug(counter +  Entering ... bar());
           System.out.println(counter +  Entering ... bar() from
  System.out.println());
          ...
      }

         private int counter = 0;

         private static final Logger logger = Logger.getLogger
  (FooServiceImpl .class.getName());
  } // FooServiceImpl

  It produces the following output:

  0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - 1 Entering ... bar
  ()
  0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - 1 Entering ... bar
  ()
  0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - 1 Entering ... bar
  ()
  1 Entering ... bar() from System.out.println()

  Notice that there are still several log outputs (not as expected - I
  only expect only 1 output) but only one output from System.out.println
  () (as expected) and the counter is still 1 (as expected).

  My log4j.properties

  # A default log4j configuration for log4j users.
  #
  # To use this configuration, deploy it into your application's WEB-INF/
  classes
  # directory.  You are also encouraged to edit it as you like.

  # Configure the console as our one appender
  log4j.appender.A1=org.apache.log4j.ConsoleAppender
  log4j.appender.A1.layout=org.apache.log4j.PatternLayout
  log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c]
  - %m%n

  My environtments: GAE 1.2.5, GWT 1.7, Eclipse-Galileo on Windows
  Vista.

  Why do I have several log output?

  Thanks in advance for your help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---



[appengine-java] Re: Extra log output

2009-09-23 Thread Toby Reyelts
On Wed, Sep 23, 2009 at 5:39 PM, Pion onlee2...@gmail.com wrote:


 Thanks for your reply, Toby.

 I am using log4j because I want to be consistent with some existing
 modules/classes. I did the following:

  import org.apache.log4j.Logger;


Whoops, saw the code and immediately thought it was using java.util.logging.



 I just saw
 http://logging.apache.org/log4j/1.2/faq.html#duplicate-messages.
 log4jhttp://logging.apache.org/log4j/1.2/faq.html#duplicate-messages.%0Alog4jcall
  is cumulative/additive. I called the
 BasicConfigurator.configure(); methods more than once. Now it is
 fixed.


Glad to see you solved the problem.



 Again, thanks.

 On Sep 23, 2:20 pm, Toby Reyelts to...@google.com wrote:
  You're using java.util.logging, not log4j. What does your
 logging.properties
  file look like?
 
  On Wed, Sep 23, 2009 at 5:02 PM, Pion onlee2...@gmail.com wrote:
 
   I have the following code snippet:
 
   public class FooServiceImpl extends RemoteServiceServlet implements
   ControllerInputService {
 
  @Override
   public String bar(String input) {
...
logger.debug(Entering ... bar());
   ...
   }
 
  private static final Logger logger = Logger.getLogger
   (FooServiceImpl .class.getName());
   } // FooServiceImpl
 
   It prints out the following messages:
 
   0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - Entering ... bar()
   0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - Entering ... bar()
   0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - Entering ... bar()
 
   Notice that it prints out more than 1 time. I double/triple checked
   that I only call the bar() method once.
 
   Then, I modified the code as the following:
 
   public class FooServiceImpl extends RemoteServiceServlet implements
   ControllerInputService {
 
  @Override
   public String bar(String input) {
...
counter++;
logger.debug(counter +  Entering ... bar());
System.out.println(counter +  Entering ... bar() from
   System.out.println());
   ...
   }
 
  private int counter = 0;
 
  private static final Logger logger = Logger.getLogger
   (FooServiceImpl .class.getName());
   } // FooServiceImpl
 
   It produces the following output:
 
   0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - 1 Entering ... bar
   ()
   0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - 1 Entering ... bar
   ()
   0 [btpool0-3] DEBUG com.col.server.FooServiceImpl - 1 Entering ... bar
   ()
   1 Entering ... bar() from System.out.println()
 
   Notice that there are still several log outputs (not as expected - I
   only expect only 1 output) but only one output from System.out.println
   () (as expected) and the counter is still 1 (as expected).
 
   My log4j.properties
 
   # A default log4j configuration for log4j users.
   #
   # To use this configuration, deploy it into your application's WEB-INF/
   classes
   # directory.  You are also encouraged to edit it as you like.
 
   # Configure the console as our one appender
   log4j.appender.A1=org.apache.log4j.ConsoleAppender
   log4j.appender.A1.layout=org.apache.log4j.PatternLayout
   log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c]
   - %m%n
 
   My environtments: GAE 1.2.5, GWT 1.7, Eclipse-Galileo on Windows
   Vista.
 
   Why do I have several log output?
 
   Thanks in advance for your help.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---