Author: jlmonteiro
Date: Fri Aug 19 13:46:18 2011
New Revision: 1159637
URL: http://svn.apache.org/viewvc?rev=1159637&view=rev
Log:
OPENEJB-1408 Add SLF4J factory
Thanks Michael Glauche!
Added:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStream.java
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStreamFactory.java
Added:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStream.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStream.java?rev=1159637&view=auto
==============================================================================
---
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStream.java
(added)
+++
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStream.java
Fri Aug 19 13:46:18 2011
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+package org.apache.openejb.util;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Log the output to Slf4j
+ *
+ */
+
+public class Slf4jLogStream implements LogStream {
+ private Logger log;
+
+ public Slf4jLogStream(LogCategory logCategory) {
+ log = LoggerFactory.getLogger(logCategory.getName());
+ }
+
+ @Override
+ public boolean isFatalEnabled() {
+ return log.isErrorEnabled();
+ }
+
+ @Override
+ public void fatal(String message) {
+ log.error(message);
+ }
+
+ @Override
+ public void fatal(String message, Throwable t) {
+ log.error(message,t);
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return log.isErrorEnabled();
+ }
+
+ @Override
+ public void error(String message) {
+ log.error(message);
+ }
+
+ @Override
+ public void error(String message, Throwable t) {
+ log.error(message,t);
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+ return log.isWarnEnabled();
+ }
+
+ @Override
+ public void warn(String message) {
+ log.warn(message);
+ }
+
+ @Override
+ public void warn(String message, Throwable t) {
+ log.warn(message,t);
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return log.isInfoEnabled();
+ }
+
+ @Override
+ public void info(String message) {
+ log.info(message);
+ }
+
+ @Override
+ public void info(String message, Throwable t) {
+ log.info(message,t);
+ }
+
+ @Override
+ public boolean isDebugEnabled() {
+ return log.isDebugEnabled();
+ }
+
+ @Override
+ public void debug(String message) {
+ log.debug(message);
+ }
+
+ @Override
+ public void debug(String message, Throwable t) {
+ log.debug(message,t);
+ }
+
+}
Added:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStreamFactory.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStreamFactory.java?rev=1159637&view=auto
==============================================================================
---
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStreamFactory.java
(added)
+++
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Slf4jLogStreamFactory.java
Fri Aug 19 13:46:18 2011
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+package org.apache.openejb.util;
+
+/**
+ * Simple Slf4jLogStream, not much configuration needed, as slf4j is just a
facade
+ *
+ */
+
+public class Slf4jLogStreamFactory implements LogStreamFactory {
+
+ @Override
+ public LogStream createLogStream(LogCategory logCategory) {
+ return new Slf4jLogStream(logCategory);
+ }
+
+}