Author: jochen
Date: Tue Nov  4 20:53:14 2014
New Revision: 1636731

URL: http://svn.apache.org/r1636731
Log:
Adding a module, which injects Log4j 2 Loggers.

Added:
    
commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/Log4j2LoggerModule.java
   (with props)

Added: 
commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/Log4j2LoggerModule.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/Log4j2LoggerModule.java?rev=1636731&view=auto
==============================================================================
--- 
commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/Log4j2LoggerModule.java
 (added)
+++ 
commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/Log4j2LoggerModule.java
 Tue Nov  4 20:53:14 2014
@@ -0,0 +1,36 @@
+/**
+ 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.commons.inject.api;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+
+/**
+ * A {@link IModule module}, which injects Log4J 2 Loggers, aka instances of
+ * {@link Logger}.
+ * If you are using the module, it should precede all others in your module 
list,
+ * when invoking {@link 
CommonsInject#build(org.apache.commons.inject.api.bind.IModule...)},
+ * or {@link CommonsInject#build(java.util.Collection)}. However, the
+ * {@link PostConstructModule} takes precedence, if you are using that as well.
+ */
+public class Log4j2LoggerModule extends AbstractLoggerInjectingModule<Logger> {
+       @Override
+       protected Logger newLogger(String pId) {
+               return LogManager.getLogger(pId);
+       }
+}

Propchange: 
commons/sandbox/commons-inject/trunk/src/main/java/org/apache/commons/inject/api/Log4j2LoggerModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to