You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@onami.apache.org by gr...@apache.org on 2012/11/29 16:29:26 UTC
svn commit: r1415209 - in /incubator/onami/trunk/logging: ./ log4j2/
log4j2/src/ log4j2/src/main/ log4j2/src/main/java/
log4j2/src/main/java/org/ log4j2/src/main/java/org/apache/
log4j2/src/main/java/org/apache/onami/ log4j2/src/main/java/org/apache/on...
Author: grobmeier
Date: Thu Nov 29 15:29:24 2012
New Revision: 1415209
URL: http://svn.apache.org/viewvc?rev=1415209&view=rev
Log:
created log4j2 injector
Added:
incubator/onami/trunk/logging/log4j2/
incubator/onami/trunk/logging/log4j2/pom.xml (with props)
incubator/onami/trunk/logging/log4j2/src/
incubator/onami/trunk/logging/log4j2/src/main/
incubator/onami/trunk/logging/log4j2/src/main/java/
incubator/onami/trunk/logging/log4j2/src/main/java/org/
incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/
incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/
incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/
incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/
incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4J2LoggerInjector.java (with props)
incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4j2LoggingModule.java (with props)
incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/package-info.java (with props)
incubator/onami/trunk/logging/log4j2/src/test/
incubator/onami/trunk/logging/log4j2/src/test/java/
incubator/onami/trunk/logging/log4j2/src/test/java/org/
incubator/onami/trunk/logging/log4j2/src/test/java/org/apache/
incubator/onami/trunk/logging/log4j2/src/test/java/org/apache/onami/
incubator/onami/trunk/logging/log4j2/src/test/java/org/apache/onami/logging/
incubator/onami/trunk/logging/log4j2/src/test/java/org/apache/onami/logging/log4j2/
incubator/onami/trunk/logging/log4j2/src/test/java/org/apache/onami/logging/log4j2/Log4j2LoggingTestCase.java (with props)
incubator/onami/trunk/logging/log4j2/src/test/resources/
incubator/onami/trunk/logging/log4j2/src/test/resources/testng.xml (with props)
Modified:
incubator/onami/trunk/logging/pom.xml
Added: incubator/onami/trunk/logging/log4j2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/logging/log4j2/pom.xml?rev=1415209&view=auto
==============================================================================
--- incubator/onami/trunk/logging/log4j2/pom.xml (added)
+++ incubator/onami/trunk/logging/log4j2/pom.xml Thu Nov 29 15:29:24 2012
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ | 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.onami.logging</groupId>
+ <artifactId>onami-logging-parent</artifactId>
+ <version>3.4-SNAPSHOT-incubating</version>
+ <relativePath>../</relativePath>
+ </parent>
+
+ <artifactId>onami-logging-log4j2</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Onami-Logging :: Apache Log4j2</name>
+ <description>Apache Onami-Logging-Log4j2 is an Apache Log4j2 Injector</description>
+
+ <properties>
+ <site.skip>true</site.skip>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>onami-logging-core</artifactId>
+ <version>${project.parent.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <version>2.0-beta3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>2.0-beta3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>onami-logging-testfw</artifactId>
+ <version>${project.parent.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}/../</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
+</project>
Propchange: incubator/onami/trunk/logging/log4j2/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4J2LoggerInjector.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4J2LoggerInjector.java?rev=1415209&view=auto
==============================================================================
--- incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4J2LoggerInjector.java (added)
+++ incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4J2LoggerInjector.java Thu Nov 29 15:29:24 2012
@@ -0,0 +1,52 @@
+package org.apache.onami.logging.log4j2;
+
+/*
+ * 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.
+ */
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.onami.logging.core.AbstractLoggerInjector;
+
+import java.lang.reflect.Field;
+
+/**
+ * {@code Apache Commons Logging} logger injector implementation.
+ */
+public final class Log4J2LoggerInjector
+ extends AbstractLoggerInjector<Logger>
+{
+
+ /**
+ * Creates a new {@code Apache Commons Logging} Logger injector.
+ *
+ * @param field the logger field has to be injected.
+ */
+ public Log4J2LoggerInjector(Field field)
+ {
+ super( field );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Logger createLogger( Class<?> klass )
+ {
+ return LogManager.getLogger(klass);
+ }
+
+}
Propchange: incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4J2LoggerInjector.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4j2LoggingModule.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4j2LoggingModule.java?rev=1415209&view=auto
==============================================================================
--- incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4j2LoggingModule.java (added)
+++ incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4j2LoggingModule.java Thu Nov 29 15:29:24 2012
@@ -0,0 +1,53 @@
+package org.apache.onami.logging.log4j2;
+
+/*
+ * 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.
+ */
+
+import com.google.inject.TypeLiteral;
+import com.google.inject.matcher.Matcher;
+import org.apache.logging.log4j.Logger;
+import org.apache.onami.logging.core.AbstractLoggingModule;
+
+import static com.google.inject.matcher.Matchers.any;
+
+/**
+ * {@code Apache Log4j2} logger module implementation.
+ */
+public final class Log4j2LoggingModule extends AbstractLoggingModule<Logger> {
+
+ /**
+ * Creates a new {@code Apache Log4j2} injection module that matches any class.
+ *
+ * @since 3.1
+ */
+ public Log4j2LoggingModule()
+ {
+ super( any(), Log4J2LoggerInjector.class );
+ }
+
+ /**
+ * Creates a new {@code Apache Log4j2} injection module.
+ *
+ * @param matcher types matcher for whom the Logger injection has to be
+ * performed.
+ */
+ public Log4j2LoggingModule(Matcher<? super TypeLiteral<?>> matcher)
+ {
+ super( matcher, Log4J2LoggerInjector.class );
+ }
+
+}
Propchange: incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/Log4j2LoggingModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/package-info.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/package-info.java?rev=1415209&view=auto
==============================================================================
--- incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/package-info.java (added)
+++ incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/package-info.java Thu Nov 29 15:29:24 2012
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2010-2012 The 99 Software Foundation
+ *
+ * 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.
+ */
+
+/**
+ * Apache Log4j2 injection implementation.
+ */
+package org.apache.onami.logging.log4j2;
Propchange: incubator/onami/trunk/logging/log4j2/src/main/java/org/apache/onami/logging/log4j2/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/onami/trunk/logging/log4j2/src/test/java/org/apache/onami/logging/log4j2/Log4j2LoggingTestCase.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/logging/log4j2/src/test/java/org/apache/onami/logging/log4j2/Log4j2LoggingTestCase.java?rev=1415209&view=auto
==============================================================================
--- incubator/onami/trunk/logging/log4j2/src/test/java/org/apache/onami/logging/log4j2/Log4j2LoggingTestCase.java (added)
+++ incubator/onami/trunk/logging/log4j2/src/test/java/org/apache/onami/logging/log4j2/Log4j2LoggingTestCase.java Thu Nov 29 15:29:24 2012
@@ -0,0 +1,50 @@
+package org.apache.onami.logging.log4j2;
+
+/*
+ * 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.
+ */
+
+import org.apache.logging.log4j.Logger;
+import org.apache.onami.logging.core.InjectLogger;
+import org.apache.onami.logging.testfw.AbstractLoggerInectionTestCase;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import static com.google.inject.TypeLiteral.get;
+import static com.google.inject.matcher.Matchers.only;
+
+/**
+ *
+ */
+public final class Log4j2LoggingTestCase
+ extends AbstractLoggerInectionTestCase<Logger>
+{
+ @InjectLogger
+ private Logger logger;
+
+ @BeforeTest
+ public void setUp()
+ {
+ super.setUp( new Log4j2LoggingModule( only( get( this.getClass() ) ) ) );
+ }
+
+ @Test
+ public void injectAndVerify()
+ {
+ this.injectAndVerify( this.logger );
+ }
+
+}
Propchange: incubator/onami/trunk/logging/log4j2/src/test/java/org/apache/onami/logging/log4j2/Log4j2LoggingTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/onami/trunk/logging/log4j2/src/test/resources/testng.xml
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/logging/log4j2/src/test/resources/testng.xml?rev=1415209&view=auto
==============================================================================
--- incubator/onami/trunk/logging/log4j2/src/test/resources/testng.xml (added)
+++ incubator/onami/trunk/logging/log4j2/src/test/resources/testng.xml Thu Nov 29 15:29:24 2012
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<!--
+ | 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.
+-->
+<suite name="onami-logging-log4j2">
+
+ <test name="log-injection">
+ <classes>
+ <class name="org.apache.onami.logging.log4j2.Log4j2LoggingTestCase" />
+ </classes>
+ </test>
+
+</suite>
Propchange: incubator/onami/trunk/logging/log4j2/src/test/resources/testng.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/onami/trunk/logging/pom.xml
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/logging/pom.xml?rev=1415209&r1=1415208&r2=1415209&view=diff
==============================================================================
--- incubator/onami/trunk/logging/pom.xml (original)
+++ incubator/onami/trunk/logging/pom.xml Thu Nov 29 15:29:24 2012
@@ -14,8 +14,7 @@
| 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -40,6 +39,7 @@
<module>commons-logging</module>
<module>log4j</module>
<module>slf4j</module>
+ <module>log4j2</module>
</modules>
<scm>
@@ -81,4 +81,4 @@
</dependency>
</dependencies>
-</project>
+</project>
\ No newline at end of file