Author: slaws
Date: Sun Sep 2 07:56:57 2007
New Revision: 571998
URL: http://svn.apache.org/viewvc?rev=571998&view=rev
Log:
Add example without special Tuscany logging wrapper
Added:
incubator/tuscany/sandbox/slaws/logging/src/main/java/pathb/tuscany-messages_en.properties
incubator/tuscany/sandbox/slaws/logging/src/main/resources/tuscany-logging.properties
incubator/tuscany/sandbox/slaws/logging/src/main/resources/tuscany-messages_en.properties
Removed:
incubator/tuscany/sandbox/slaws/logging/src/main/resources/logging.properties
Modified:
incubator/tuscany/sandbox/slaws/logging/src/main/java/patha/SomeTuscanyClassA.java
incubator/tuscany/sandbox/slaws/logging/src/main/java/pathb/SomeTuscanyClassB.java
incubator/tuscany/sandbox/slaws/logging/src/test/java/test/LoggingTestCase.java
Modified:
incubator/tuscany/sandbox/slaws/logging/src/main/java/patha/SomeTuscanyClassA.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/slaws/logging/src/main/java/patha/SomeTuscanyClassA.java?rev=571998&r1=571997&r2=571998&view=diff
==============================================================================
---
incubator/tuscany/sandbox/slaws/logging/src/main/java/patha/SomeTuscanyClassA.java
(original)
+++
incubator/tuscany/sandbox/slaws/logging/src/main/java/patha/SomeTuscanyClassA.java
Sun Sep 2 07:56:57 2007
@@ -7,16 +7,15 @@
public class SomeTuscanyClassA {
- private static final Logger Log =
Logger.getLogger(SomeTuscanyClassA.class.getName());
- private static final Logger Log1 =
LogUtils.getL7dLogger(SomeTuscanyClassA.class);
+ private static final Logger Log =
LogUtils.getL7dLogger(SomeTuscanyClassA.class);
public SomeTuscanyClassA() {
- Log.info("A Constructor");
Integer params[] = {8, 9, 4};
+
- LogUtils.log(Log1,
+ LogUtils.log(Log,
Level.INFO,
"TEST_MESSAGE",
null,
@@ -24,7 +23,7 @@
Exception ex = new IllegalStateException("TEST_MESSAGE");
- LogUtils.log(Log1,
+ LogUtils.log(Log,
Level.INFO,
"TEST_MESSAGE",
ex,
Modified:
incubator/tuscany/sandbox/slaws/logging/src/main/java/pathb/SomeTuscanyClassB.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/slaws/logging/src/main/java/pathb/SomeTuscanyClassB.java?rev=571998&r1=571997&r2=571998&view=diff
==============================================================================
---
incubator/tuscany/sandbox/slaws/logging/src/main/java/pathb/SomeTuscanyClassB.java
(original)
+++
incubator/tuscany/sandbox/slaws/logging/src/main/java/pathb/SomeTuscanyClassB.java
Sun Sep 2 07:56:57 2007
@@ -1,5 +1,48 @@
package pathb;
+import java.io.InputStream;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+
+import patha.SomeTuscanyClassA;
+
public class SomeTuscanyClassB {
+ private static final Logger Log =
Logger.getLogger(SomeTuscanyClassA.class.getName());
+
+
+ public SomeTuscanyClassB() {
+
+ Logger Log1 = Logger.getLogger("pathb", "tuscany-messages");
+ Logger Log =
Logger.getLogger(SomeTuscanyClassB.class.getName());
+ String rbName = Log.getResourceBundleName();
+
+ Log.log(Level.INFO,
+ "MESSAGE1");
+
+
+ String componentName = "Some component";
+
+ Log.log(Level.INFO,
+ "MESSAGE2", // message id
+ componentName); // parameter
+
+ Integer params[] = {8, 9, 4};
+
+ Log.log(Level.INFO,
+ "MESSAGE3", // message id
+ params); // parameter
+
+
+ Exception ex = new IllegalStateException("TEST_MESSAGE");
+
+ Log.log(Level.INFO,
+ "MESSAGE4", // message id
+ ex); // parameter
+
+
+ }
}
Added:
incubator/tuscany/sandbox/slaws/logging/src/main/java/pathb/tuscany-messages_en.properties
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/slaws/logging/src/main/java/pathb/tuscany-messages_en.properties?rev=571998&view=auto
==============================================================================
---
incubator/tuscany/sandbox/slaws/logging/src/main/java/pathb/tuscany-messages_en.properties
(added)
+++
incubator/tuscany/sandbox/slaws/logging/src/main/java/pathb/tuscany-messages_en.properties
Sun Sep 2 07:56:57 2007
@@ -0,0 +1,24 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+#
+MESSAGE1 = This is a test message with no params
+MESSAGE2 = This is a test message with a string param {0}
+MESSAGE3 = This is a test message with numbers {0}, {1}, {2}
+MESSAGE4 = This is a test message with exception
Added:
incubator/tuscany/sandbox/slaws/logging/src/main/resources/tuscany-logging.properties
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/slaws/logging/src/main/resources/tuscany-logging.properties?rev=571998&view=auto
==============================================================================
---
incubator/tuscany/sandbox/slaws/logging/src/main/resources/tuscany-logging.properties
(added)
+++
incubator/tuscany/sandbox/slaws/logging/src/main/resources/tuscany-logging.properties
Sun Sep 2 07:56:57 2007
@@ -0,0 +1,73 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+############################################################
+# Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+# Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler
+# classes. These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the WARNING and above levels.
+handlers= java.util.logging.ConsoleHandler, java.util.logging.FileHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers. For any given facility this global level
+# can be overriden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= WARNING
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to WARNING and above.
+java.util.logging.ConsoleHandler.level = INFO
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+#java.util.logging.ConsoleHandler.formatter =
demos.ws_rm.common.ConciseFormatter
+
+
+############################################################
+# Logger specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+#com.xyz.foo.level = SEVERE
+
+patha.SomeTuscanyClassA.level=INFO
+pathb.SomeTuscanyClassB.level=INFO
+
Added:
incubator/tuscany/sandbox/slaws/logging/src/main/resources/tuscany-messages_en.properties
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/slaws/logging/src/main/resources/tuscany-messages_en.properties?rev=571998&view=auto
==============================================================================
---
incubator/tuscany/sandbox/slaws/logging/src/main/resources/tuscany-messages_en.properties
(added)
+++
incubator/tuscany/sandbox/slaws/logging/src/main/resources/tuscany-messages_en.properties
Sun Sep 2 07:56:57 2007
@@ -0,0 +1,24 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+#
+MESSAGE1 = This is a test message with no params
+MESSAGE2 = This is a test message with a string param {0}
+MESSAGE3 = This is a test message with numbers {0}, {1}, {2}
+MESSAGE4 = This is a test message with exception
Modified:
incubator/tuscany/sandbox/slaws/logging/src/test/java/test/LoggingTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/sandbox/slaws/logging/src/test/java/test/LoggingTestCase.java?rev=571998&r1=571997&r2=571998&view=diff
==============================================================================
---
incubator/tuscany/sandbox/slaws/logging/src/test/java/test/LoggingTestCase.java
(original)
+++
incubator/tuscany/sandbox/slaws/logging/src/test/java/test/LoggingTestCase.java
Sun Sep 2 07:56:57 2007
@@ -18,11 +18,15 @@
*/
package test;
+import java.io.InputStream;
+import java.util.logging.LogManager;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import patha.SomeTuscanyClassA;
+import pathb.SomeTuscanyClassB;
@@ -41,9 +45,25 @@
public void tearDown() throws Exception {
}
-
+
@Test
- public void testCalculator() throws Exception {
+ public void testUtilLogger() throws Exception {
+
+ try {
+ InputStream logConfigStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream("tuscany-logging.properties");
+
LogManager.getLogManager().readConfiguration(logConfigStream);
+ } catch(Exception ex) {
+ System.out.println("Can't find logging.properties on
the classpath");
+ }
+
+ SomeTuscanyClassB stcB = new SomeTuscanyClassB();
+
+ }
+
+ //@Test
+ public void testSpecilizedLogger() throws Exception {
+
+
SomeTuscanyClassA stcA = new SomeTuscanyClassA();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]