You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pirk.apache.org by ea...@apache.org on 2016/07/31 15:49:04 UTC
incubator-pirk git commit: [PIRK-28]: Logger Statements Not Working
in/from Drivers - closes apache/incubator-pirk#33
Repository: incubator-pirk
Updated Branches:
refs/heads/master a5113dd3e -> 1509bd408
[PIRK-28]: Logger Statements Not Working in/from Drivers - closes apache/incubator-pirk#33
Project: http://git-wip-us.apache.org/repos/asf/incubator-pirk/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-pirk/commit/1509bd40
Tree: http://git-wip-us.apache.org/repos/asf/incubator-pirk/tree/1509bd40
Diff: http://git-wip-us.apache.org/repos/asf/incubator-pirk/diff/1509bd40
Branch: refs/heads/master
Commit: 1509bd4089d30ed06f13218cc4cc89ba786ab04d
Parents: a5113dd
Author: smarthi <sm...@apache.org>
Authored: Sun Jul 31 11:48:51 2016 -0400
Committer: eawilliams <ea...@apache.org>
Committed: Sun Jul 31 11:48:51 2016 -0400
----------------------------------------------------------------------
pom.xml | 75 ++++++++++++++++----
.../apache/pirk/utils/SystemConfiguration.java | 3 +-
src/main/resources/log4j2.properties | 57 ---------------
src/main/resources/log4j2.xml | 49 +++++++++++++
src/main/resources/pirk.properties | 5 +-
.../test/schema/data/LoadDataSchemaTest.java | 2 +-
6 files changed, 112 insertions(+), 79 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/1509bd40/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 40a581a..db25db1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,17 +95,14 @@
<slf4j.version>1.7.21</slf4j.version>
<log4j2.version>2.6.2</log4j2.version>
<junit.version>4.12</junit.version>
- <log4j.configuration>log4j2.properties</log4j.configuration>
+ <log4j.configuration>log4j2.xml</log4j.configuration>
+ <hadoop.version>2.7.2</hadoop.version>
+ <apache-commons.version>3.3</apache-commons.version>
+ <elasticsearch.version>2.3.3</elasticsearch.version>
</properties>
<dependencies>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.17</version>
- </dependency>
-
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
@@ -114,7 +111,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
- <version>3.3</version>
+ <version>${apache-commons.version}</version>
</dependency>
<dependency>
@@ -126,37 +123,73 @@
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
- <version>3.3</version>
+ <version>${apache-commons.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
- <version>2.7.2</version>
+ <version>${hadoop.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-core</artifactId>
- <version>2.7.2</version>
+ <version>${hadoop.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
- <version>2.7.2</version>
+ <version>${hadoop.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>1.6.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-hadoop</artifactId>
- <version>2.1.2</version>
+ <version>${elasticsearch.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-net</artifactId>
@@ -171,8 +204,12 @@
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.storm</groupId>
+ <artifactId>storm-core</artifactId>
</exclusion>
</exclusions>
</dependency>
@@ -212,6 +249,12 @@
<version>2.6.2</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>2.6.2</version>
+ </dependency>
+
</dependencies>
<build>
@@ -545,3 +588,5 @@
</profiles>
</project>
+Contact GitHub API Training Shop Blog About
+� 2016 GitHub, Inc. Terms Privacy Security Status Help
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/1509bd40/src/main/java/org/apache/pirk/utils/SystemConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/pirk/utils/SystemConfiguration.java b/src/main/java/org/apache/pirk/utils/SystemConfiguration.java
index b5ac98f..ae5f485 100755
--- a/src/main/java/org/apache/pirk/utils/SystemConfiguration.java
+++ b/src/main/java/org/apache/pirk/utils/SystemConfiguration.java
@@ -194,9 +194,8 @@ public class SystemConfiguration
*/
public static void loadPropsFromStream(String name)
{
- try
+ try(InputStream stream = SystemConfiguration.class.getClassLoader().getResourceAsStream(name))
{
- InputStream stream = SystemConfiguration.class.getClassLoader().getResourceAsStream(name);
if (stream != null)
{
logger.info("Loading file '" + name + "'");
http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/1509bd40/src/main/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/src/main/resources/log4j2.properties b/src/main/resources/log4j2.properties
deleted file mode 100755
index 2a318be..0000000
--- a/src/main/resources/log4j2.properties
+++ /dev/null
@@ -1,57 +0,0 @@
-###############################################################################
-# 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.
-###############################################################################
-# Pirk Log4j Properties file
-
-# Logging levels in order of verboseness: trace, debug, info, warn, error, fatal
-log4j.rootLogger=info, stdout, rolling
-#log4j.rootLogger=debug, stdout, rolling
-#log4j.rootLogger=trace, debug, info, stdout, rolling
-#log4j.rootLogger=debug, info, stdout, rolling
-
-# Example of adding a specific package/class at a different
-#log4j.category.org.apache.pirk=debug
-
-
-# BEGIN APPENDER: CONSOLE APPENDER (stdout)
-# first: type of appender (fully qualified class name)
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-
-# second: Any configuration information needed for that appender.
-# Many appenders require a layout.
-# log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-# Pattern to output the caller's file name and line number.
-log4j.appender.stdout.layout.ConversionPattern=%5p [%t] %d (%F:%L) - %m%n
-
-
-# BEGIN APPENDER: ROLLING FILE APPENDER (rolling)
-# first: type of appender (fully qualified class name)
-log4j.appender.rolling=org.apache.log4j.RollingFileAppender
-log4j.appender.rolling.File=./logs/pirk.log
-log4j.appender.rolling.MaxFileSize=1MB
-# number of backups to keep
-log4j.appender.rolling.MaxBackupIndex=2
-
-log4j.appender.rolling.layout=org.apache.log4j.PatternLayout
-log4j.appender.rolling.layout.ConversionPattern=%d %-5p %-17c{2} %3x - %m%n
-
-log4j.logger.org.apache.zookeeper=error
-log4j.logger.org.apache.hadoop.hbase=info
-log4j.logger.org.apache.hadoop.hbase.zookeeper=warn
-
http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/1509bd40/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..81549db
--- /dev/null
+++ b/src/main/resources/log4j2.xml
@@ -0,0 +1,49 @@
+<?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.
+ -->
+<Configuration>
+ <Properties>
+ <Property name="projectPrefix">pirk</Property>
+ <Property name="Directory">./logs</Property>
+ <Property name="Filename">${projectPrefix}.log</Property>
+ </Properties>
+
+ <Appenders>
+ <Console name="STDOUT" target="SYSTEM_OUT">
+ <PatternLayout pattern="%5p [%t] %d (%F:%L) - %m%n"/>
+ </Console>
+
+ <RollingFile name="RollingFile" fileName="${Directory}/${Filename}" filePattern="${projectPrefix}-%i.log">
+ <PatternLayout pattern="%d %-5p %-17c{2} %3x - %m%n"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="1 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="2"/>
+ </RollingFile>
+ </Appenders>
+
+ <Loggers>
+ <Logger name="org.apache.hadoop.hbase" level="info" additivity="false"/>
+ <Logger name="org.apache.hadoop.hbase.zookeeper" level="warn" additivity="false"/>
+ <Logger name="org.apache.zookeeper" level="error" additivity="false"/>
+ <Root level="info">
+ <AppenderRef ref="STDOUT"/>
+ <AppenderRef ref="RollingFile"/>
+ </Root>
+ </Loggers>
+
+</Configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/1509bd40/src/main/resources/pirk.properties
----------------------------------------------------------------------
diff --git a/src/main/resources/pirk.properties b/src/main/resources/pirk.properties
index eb386da..aee87ad 100755
--- a/src/main/resources/pirk.properties
+++ b/src/main/resources/pirk.properties
@@ -21,10 +21,7 @@
## Default System Configuration Properties
##
-# Name of log4j properties file (relative to current folder)
-log4jPropertiesFile=logging/log4j2.properties
-
-#Name of the local properties file - used when running with the
+#Name of the local properties file - used when running with the
#hadoop jar command
local.pirk.properties=/root/
http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/1509bd40/src/test/java/test/schema/data/LoadDataSchemaTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/test/schema/data/LoadDataSchemaTest.java b/src/test/java/test/schema/data/LoadDataSchemaTest.java
index 07167fc..b1b8ec4 100644
--- a/src/test/java/test/schema/data/LoadDataSchemaTest.java
+++ b/src/test/java/test/schema/data/LoadDataSchemaTest.java
@@ -50,7 +50,7 @@ import org.w3c.dom.Element;
*/
public class LoadDataSchemaTest
{
- private static Logger logger = LoggerFactory.getLogger(LoadDataSchemaTest.class);
+ private static final Logger logger = LoggerFactory.getLogger(LoadDataSchemaTest.class);
private String dataSchemaName = "fakeDataSchema";