Author: jboynes
Date: Sat Apr  8 16:02:57 2006
New Revision: 392628

URL: http://svn.apache.org/viewcvs?rev=392628&view=rev
Log:
setup custom JSR47 logging for the sample

Added:
    
incubator/tuscany/java/samples/helloworld/helloworld/src/main/resources/logging.properties
   (with props)
Modified:
    
incubator/tuscany/java/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldClient.java

Modified: 
incubator/tuscany/java/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldClient.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldClient.java?rev=392628&r1=392627&r2=392628&view=diff
==============================================================================
--- 
incubator/tuscany/java/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldClient.java
 (original)
+++ 
incubator/tuscany/java/samples/helloworld/helloworld/src/main/java/org/apache/tuscany/samples/helloworld/HelloWorldClient.java
 Sat Apr  8 16:02:57 2006
@@ -17,6 +17,7 @@
 package org.apache.tuscany.samples.helloworld;
 
 import java.util.logging.Level;
+import java.util.logging.LogManager;
 import java.util.Properties;
 
 import org.osoa.sca.CurrentModuleContext;
@@ -33,14 +34,15 @@
 public class HelloWorldClient {
 
     public static final void main(String[] args) throws Exception {
-        // Setup Tuscany monitoring to use java.util.logging 
+        // Setup Tuscany monitoring to use java.util.logging
+        
LogManager.getLogManager().readConfiguration(HelloWorldClient.class.getResourceAsStream("/logging.properties"));
         Properties levels = new Properties();
-        MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, 
Level.INFO, null);
+        MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, 
Level.FINEST, "MonitorMessages");
 
         // Obtain Tuscany runtime
         TuscanyRuntime tuscany = new TuscanyRuntime("hello", null, 
monitorFactory);
 
-        // Start the runtime
+        // Associate the application module component with this thread
         tuscany.start();
 
         // Obtain SCA module context.
@@ -48,12 +50,13 @@
 
         // Locate the HelloWorld service component and invoke it
         HelloWorldService helloworldService = (HelloWorldService) 
moduleContext.locateService("HelloWorldServiceComponent");
-
         String value = helloworldService.getGreetings("World");
-
         System.out.println(value);
 
-        // Stop the runtime
+        // Disassociate the application module component
         tuscany.stop();
+
+        // Shut down the runtime
+        tuscany.shutdown();
     }
 }

Added: 
incubator/tuscany/java/samples/helloworld/helloworld/src/main/resources/logging.properties
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/samples/helloworld/helloworld/src/main/resources/logging.properties?rev=392628&view=auto
==============================================================================
--- 
incubator/tuscany/java/samples/helloworld/helloworld/src/main/resources/logging.properties
 (added)
+++ 
incubator/tuscany/java/samples/helloworld/helloworld/src/main/resources/logging.properties
 Sat Apr  8 16:02:57 2006
@@ -0,0 +1,27 @@
+#  Copyright (c) 2006 The Apache Software Foundation or its licensors, as 
applicable.
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  $Rev$ $Date$
+#
+
+# Custom logging configuration for Tuscany samples
+# By default, only INFO level logging is enabled and ALL messages get sent to 
the console
+# For more messages from the runtime, uncomment specific settings at the end 
of this file
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+.level=INFO
+
+# Uncomment the next setting to get all Tuscany messages (this will be a lot)
+#org.apache.tuscany.level=FINEST
\ No newline at end of file

Propchange: 
incubator/tuscany/java/samples/helloworld/helloworld/src/main/resources/logging.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/samples/helloworld/helloworld/src/main/resources/logging.properties
------------------------------------------------------------------------------
    svn:keywords = Rev,Date


Reply via email to