You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by st...@apache.org on 2022/08/04 12:02:34 UTC

[phoenix] branch master updated: PHOENIX-6756 switch to using log4j2.properties instead of xml

This is an automated email from the ASF dual-hosted git repository.

stoty pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/master by this push:
     new 6952c6c81d PHOENIX-6756 switch to using log4j2.properties instead of xml
6952c6c81d is described below

commit 6952c6c81d2abd0201b140bbce2f31b4efe604ca
Author: Istvan Toth <st...@apache.org>
AuthorDate: Fri Jul 29 09:24:42 2022 +0200

    PHOENIX-6756 switch to using log4j2.properties instead of xml
    
    also fix serveral problems introduced in the original log4j2 patch
    change log format to match HBase both for tests and utilities
---
 bin/log4j2.properties                              | 67 ++++++++++++++++++++++
 bin/log4j2.xml                                     | 61 --------------------
 bin/performance.py                                 |  4 +-
 bin/pherf-standalone.py                            |  4 +-
 bin/phoenix_sandbox.py                             |  4 +-
 bin/psql.py                                        |  4 +-
 bin/sandbox-log4j.properties                       | 45 ---------------
 bin/sandbox-log4j2.properties                      | 65 +++++++++++++++++++++
 bin/sqlline.py                                     |  2 +-
 bin/traceserver.py                                 |  4 +-
 phoenix-core/src/it/resources/log4j.properties     | 63 --------------------
 .../src/it/resources/log4j2-test.properties        | 45 +++++++++++++++
 phoenix-core/src/it/resources/log4j2-test.xml      | 49 ----------------
 phoenix-core/src/test/resources/log4j.properties   | 65 ---------------------
 .../src/test/resources/log4j2-test.properties      | 50 ++++++++++++++++
 phoenix-core/src/test/resources/log4j2-test.xml    | 51 ----------------
 phoenix-pherf/config/log4j2.properties             | 67 ++++++++++++++++++++++
 phoenix-pherf/config/log4j2.xml                    | 51 ----------------
 18 files changed, 306 insertions(+), 395 deletions(-)

diff --git a/bin/log4j2.properties b/bin/log4j2.properties
new file mode 100644
index 0000000000..5e1875a2d1
--- /dev/null
+++ b/bin/log4j2.properties
@@ -0,0 +1,67 @@
+#/**
+# * 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.
+# */
+
+# This config is used by sqlline, pherf and psql
+
+status = warn
+dest = err
+name = PropertiesConfig
+
+# Console appender
+appender.console.type = Console
+appender.console.target = SYSTEM_ERR
+appender.console.name = console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{ISO8601} %-5p [%t] %c{2}: %.1000m%n
+
+# Not used by default
+# Daily Rolling File Appender
+appender.DRFA.type = RollingFile
+appender.DRFA.name = DRFA
+appender.DRFA.fileName = ${sys:psql.log.dir:-.}/${sys:psql.log.file:-psql.log}
+appender.DRFA.filePattern = ${sys:psql.log.dir:-.}/${sys:psql.log.file:-psql.log}.%d{yyyy-MM-dd}
+appender.DRFA.createOnDemand = true
+appender.DRFA.layout.type = PatternLayout
+appender.DRFA.layout.pattern = %d{ISO8601} %-5p [%t] %c{2}: %.1000m%n
+appender.DRFA.policies.type = Policies
+appender.DRFA.policies.time.type = TimeBasedTriggeringPolicy
+appender.DRFA.policies.time.interval = 1
+appender.DRFA.policies.time.modulate = true
+appender.DRFA.policies.size.type = SizeBasedTriggeringPolicy
+appender.DRFA.policies.size.size = ${sys:psql.log.maxfilesize:-256MB}
+appender.DRFA.strategy.type = DefaultRolloverStrategy
+appender.DRFA.strategy.max = ${sys:psql.log.maxbackupindex:-20}
+
+# Null Appender
+appender.NullAppender.type = Null
+appender.NullAppender.name = NullAppender
+
+rootLogger = ${sys:psql.root.logger:-WARN,console}
+
+# Custom Logging levels
+logger.zookeeper.name = org.apache.zookeeper
+logger.zookeeper.level = ERROR
+
+logger.hbase_zk_rzk.name = org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper
+logger.hbase_zk_rzk.level = ERROR
+
+logger.hbase_zk_zku.name = org.apache.hadoop.hbase.zookeeper.ZKUtil
+logger.hbase_zk_zku.level = ERROR
+
+logger.hbase_conf.name = org.apache.hadoop.hbase.HBaseConfiguration
+logger.hbase_conf.level = ERROR
diff --git a/bin/log4j2.xml b/bin/log4j2.xml
deleted file mode 100644
index 1d93814838..0000000000
--- a/bin/log4j2.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.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.
--->
-<Configuration name="Log4j1">
-  <Properties>
-    <Property name="hadoop.log.dir">.</Property>
-    <Property name="psql.log.dir">.</Property>
-    <Property name="psql.log.file">psql.log</Property>
-    <Property name="psql.root.logger">WARN,console</Property>
-  </Properties>
-  <ThresholdFilter onMatch="NEUTRAL" onMismatch="DENY"
-    level="INFO" />
-  <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
-      <PatternLayout
-        pattern="%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n" />
-    </Console>
-    <Null name="NullAppender" />
-    <RollingFile name="DRFA" fileName="./psql.log"
-      filePattern="./psql.log%d{.yyyy-MM-dd}">
-      <PatternLayout pattern="%d{ISO8601} %p %c: %m%n" />
-      <Policies>
-        <TimeBasedTriggeringPolicy
-          modulate="true" />
-      </Policies>
-      <DefaultRolloverStrategy max="2147483647" />
-    </RollingFile>
-  </Appenders>
-  <Loggers>
-    <Root level="WARN">
-      <AppenderRef ref="console" />
-    </Root>
-    <Logger name="org.apache.phoenix.queryserver.server"
-      level="INFO" />
-    <Logger name="org.apache.hadoop.hbase.zookeeper.ZKUtil"
-      level="ERROR" />
-    <Logger name="org.apache.calcite.avatica" level="INFO" />
-    <Logger name="org.apache.zookeeper" level="ERROR" />
-    <Logger name="org.eclipse.jetty.server" level="INFO" />
-    <Logger name="org.apache.hadoop.hbase.HBaseConfiguration"
-      level="ERROR" />
-    <Logger
-      name="org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper"
-      level="ERROR" />
-  </Loggers>
-</Configuration>
\ No newline at end of file
diff --git a/bin/performance.py b/bin/performance.py
index 212a1f659d..8599ccde49 100755
--- a/bin/performance.py
+++ b/bin/performance.py
@@ -97,8 +97,8 @@ if java_home:
 else:
     java_cmd = 'java'
 
-execute = ('%s $PHOENIX_OPTS -cp "%s%s%s%s%s" -Dlog4j.configuration=file:' +
-           os.path.join(phoenix_utils.current_dir, "log4j.properties") +
+execute = ('%s $PHOENIX_OPTS -cp "%s%s%s%s%s" -Dlog4j2.configurationFile=file:' +
+           os.path.join(phoenix_utils.current_dir, "log4j2.properties") +
            ' org.apache.phoenix.util.PhoenixRuntime -t %s %s ') % \
     (java_cmd, hbase_config_path, os.pathsep, phoenix_utils.slf4j_backend_jar, os.pathsep,
      phoenix_utils.logging_jar, os.pathsep, phoenix_utils.phoenix_client_embedded_jar,
diff --git a/bin/pherf-standalone.py b/bin/pherf-standalone.py
index 16617d6b6a..5ace94685b 100755
--- a/bin/pherf-standalone.py
+++ b/bin/pherf-standalone.py
@@ -71,8 +71,8 @@ java_cmd = java +' -Xms512m -Xmx3072m  -cp "' + \
     phoenix_utils.logging_jar + os.pathsep + \
     phoenix_utils.phoenix_client_embedded_jar + os.pathsep +\
     phoenix_utils.phoenix_pherf_jar + \
-    '" -Dlog4j.configuration=file:' + \
-    os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
+    '" -Dlog4j2.configurationFile=file:' + \
+    os.path.join(phoenix_utils.current_dir, "log4j2.properties") + \
     " org.apache.phoenix.pherf.Pherf " + args 
 
 os.execl("/bin/sh", "/bin/sh", "-c", java_cmd)
diff --git a/bin/phoenix_sandbox.py b/bin/phoenix_sandbox.py
index 5a1a78d501..5960831009 100755
--- a/bin/phoenix_sandbox.py
+++ b/bin/phoenix_sandbox.py
@@ -38,13 +38,13 @@ if not os.path.exists(cp_file_path):
                 + "phoenix-core/target, please rebuild the project first\n")
     sys.exit(1)
 
-logging_config = os.path.join(base_dir, 'bin', 'sandbox-log4j.properties')
+logging_config = os.path.join(base_dir, 'bin', 'sandbox-log4j2.properties')
 
 cp_components = [phoenix_target_dir + "/*"]
 with open(cp_file_path, 'r') as cp_file:
     cp_components.append(cp_file.read())
 
-java_cmd = ("java $PHOENIX_OPTS -Dlog4j.configuration=file:%s " +
+java_cmd = ("java $PHOENIX_OPTS -Dlog4j2.configurationFile=file:%s " +
                 "-cp %s org.apache.phoenix.Sandbox") % (
                             logging_config, ":".join(cp_components))
 
diff --git a/bin/psql.py b/bin/psql.py
index 6c63a21a03..e8165eab0e 100755
--- a/bin/psql.py
+++ b/bin/psql.py
@@ -68,8 +68,8 @@ java_cmd = java + ' $PHOENIX_OPTS ' + \
     ' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.hadoop_conf + \
     os.pathsep + phoenix_utils.slf4j_backend_jar + \
     os.pathsep + phoenix_utils.logging_jar + \
-    os.pathsep + phoenix_utils.phoenix_client_embedded_jar + '" -Dlog4j.configuration=file:' + \
-    os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
+    os.pathsep + phoenix_utils.phoenix_client_embedded_jar + '" -Dlog4j2.configurationFile=file:' + \
+    os.path.join(phoenix_utils.current_dir, "log4j2.properties") + \
     " org.apache.phoenix.util.PhoenixRuntime " + args 
 
 os.execl("/bin/sh", "/bin/sh", "-c", java_cmd)
diff --git a/bin/sandbox-log4j.properties b/bin/sandbox-log4j.properties
deleted file mode 100644
index a30f1292b8..0000000000
--- a/bin/sandbox-log4j.properties
+++ /dev/null
@@ -1,45 +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.
-#
-#
-
-# Define some default values that can be overridden by system properties
-sandbox.root.logger=INFO,console
-
-# Define the root logger to the system property "plsql.root.logger".
-log4j.rootLogger=${sandbox.root.logger}
-
-# Logging Threshold
-log4j.threshold=WARN
-
-#
-# console
-# Add "console" to rootlogger above if you want to use this
-#
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.target=System.err
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
-
-# Custom Logging levels
-log4j.logger.org.apache.zookeeper=ERROR
-log4j.logger.org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper=ERROR
-log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=ERROR
-log4j.logger.org.apache.hadoop.hbase.HBaseConfiguration=ERROR
-log4j.logger.org.apache.hadoop.hbase.ZNodeClearer=ERROR
diff --git a/bin/sandbox-log4j2.properties b/bin/sandbox-log4j2.properties
new file mode 100644
index 0000000000..d3274c2728
--- /dev/null
+++ b/bin/sandbox-log4j2.properties
@@ -0,0 +1,65 @@
+#/**
+# * 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.
+# */
+
+status = warn
+dest = err
+name = PropertiesConfig
+
+# Console appender
+appender.console.type = Console
+appender.console.target = SYSTEM_ERR
+appender.console.name = console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{ISO8601} %-5p [%t] %c{2}: %.1000m%n
+
+# Not used by default
+# Daily Rolling File Appender
+appender.DRFA.type = RollingFile
+appender.DRFA.name = DRFA
+appender.DRFA.fileName = ${sys:psql.log.dir:-.}/${sys:psql.log.file:-psql.log}
+appender.DRFA.filePattern = ${sys:psql.log.dir:-.}/${sys:psql.log.file:-psql.log}.%d{yyyy-MM-dd}
+appender.DRFA.createOnDemand = true
+appender.DRFA.layout.type = PatternLayout
+appender.DRFA.layout.pattern = %d{ISO8601} %-5p [%t] %c{2}: %.1000m%n
+appender.DRFA.policies.type = Policies
+appender.DRFA.policies.time.type = TimeBasedTriggeringPolicy
+appender.DRFA.policies.time.interval = 1
+appender.DRFA.policies.time.modulate = true
+appender.DRFA.policies.size.type = SizeBasedTriggeringPolicy
+appender.DRFA.policies.size.size = ${sys:psql.log.maxfilesize:-256MB}
+appender.DRFA.strategy.type = DefaultRolloverStrategy
+appender.DRFA.strategy.max = ${sys:psql.log.maxbackupindex:-20}
+
+# Null Appender
+appender.NullAppender.type = Null
+appender.NullAppender.name = NullAppender
+
+rootLogger = ${sys:psql.root.logger:-WARN,console}
+
+# Custom Logging levels
+logger.zookeeper.name = org.apache.zookeeper
+logger.zookeeper.level = ERROR
+
+logger.hbase_zk_rzk.name = org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper
+logger.hbase_zk_rzk.level = ERROR
+
+logger.hbase_zk_zku.name = org.apache.hadoop.hbase.zookeeper.ZKUtil
+logger.hbase_zk_zku.level = ERROR
+
+logger.hbase_conf.name = org.apache.hadoop.hbase.HBaseConfiguration
+logger.hbase_conf.level = ERROR
diff --git a/bin/sqlline.py b/bin/sqlline.py
index 615decb9d4..96ccdb6eb9 100755
--- a/bin/sqlline.py
+++ b/bin/sqlline.py
@@ -120,7 +120,7 @@ java_cmd = java + ' $PHOENIX_OPTS ' + \
     phoenix_utils.slf4j_backend_jar + os.pathsep + \
     phoenix_utils.logging_jar + os.pathsep + \
     phoenix_utils.phoenix_client_embedded_jar + \
-    '" -Dlog4j.configuration=file:' + os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
+    '" -Dlog4j2.configurationFile=file:' + os.path.join(phoenix_utils.current_dir, "log4j2.properties") + \
     disable_jna + \
     " sqlline.SqlLine -d org.apache.phoenix.jdbc.PhoenixDriver" + \
     " -u jdbc:phoenix:" + phoenix_utils.shell_quote([zookeeper]) + \
diff --git a/bin/traceserver.py b/bin/traceserver.py
index a2e6f9c27f..706cbd4421 100755
--- a/bin/traceserver.py
+++ b/bin/traceserver.py
@@ -121,9 +121,11 @@ else:
 java_cmd = '%(java)s  ' + \
     '-cp ' + hbase_config_path + os.pathsep + phoenix_utils.hadoop_conf + os.pathsep + \
     phoenix_utils.phoenix_traceserver_jar + os.pathsep + phoenix_utils.slf4j_backend_jar + os.pathsep + \
+    phoenix_utils.logging_jar + os.pathsep + \
     phoenix_utils.phoenix_client_embedded_jar + os.pathsep + phoenix_utils.phoenix_queryserver_jar + \
+    
     " -Dproc_phoenixtraceserver" + \
-    " -Dlog4j.configuration=file:" + os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
+    " -Dlog4j2.configurationFile=file:" + os.path.join(phoenix_utils.current_dir, "log4j2.properties") + \
     " -Dpsql.root.logger=%(root_logger)s" + \
     " -Dpsql.log.dir=%(log_dir)s" + \
     " -Dpsql.log.file=%(log_file)s" + \
diff --git a/phoenix-core/src/it/resources/log4j.properties b/phoenix-core/src/it/resources/log4j.properties
deleted file mode 100644
index 6b1ce5064d..0000000000
--- a/phoenix-core/src/it/resources/log4j.properties
+++ /dev/null
@@ -1,63 +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.
-
-# Define some default values that can be overridden by system properties
-hbase.root.logger=DEBUG,console
-hbase.log.dir=.
-hbase.log.file=hbase.log
-
-# Define the root logger to the system property "hbase.root.logger".
-log4j.rootLogger=${hbase.root.logger}
-
-# Logging Threshold
-log4j.threshhold=ALL
-
-#
-# Daily Rolling File Appender
-#
-log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.DRFA.File=${hbase.log.dir}/${hbase.log.file}
-
-# Rollver at midnight
-log4j.appender.DRFA.DatePattern=.yyyy-MM-dd
-
-# 30-day backup
-#log4j.appender.DRFA.MaxBackupIndex=30
-log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout
-
-# Pattern format: Date LogLevel LoggerName LogMessage
-#log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
-
-# Debugging Pattern format
-log4j.appender.DRFA.layout.ConversionPattern=%d %-5p [%t] %C{2}(%L): %m%n
-
-
-#
-# console
-# Add "console" to rootlogger above if you want to use this
-#
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.target=System.err
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d %-5p [%t] %C{2}(%L): %m%n
-
-# Custom Logging levels
-
-#log4j.logger.org.apache.hadoop.fs.FSNamesystem=DEBUG
-
-log4j.logger.org.apache.hadoop=WARN
-log4j.logger.org.apache.zookeeper=ERROR
-log4j.logger.org.apache.hadoop.hbase=DEBUG
diff --git a/phoenix-core/src/it/resources/log4j2-test.properties b/phoenix-core/src/it/resources/log4j2-test.properties
new file mode 100644
index 0000000000..9766cf8c64
--- /dev/null
+++ b/phoenix-core/src/it/resources/log4j2-test.properties
@@ -0,0 +1,45 @@
+#/**
+# * 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.
+# */
+
+status = debug
+dest = err
+name = PhoenixTest
+packages = org.apache.hadoop.hbase.logging
+
+appender.console.type = Console
+appender.console.target = SYSTEM_ERR
+appender.console.name = Console
+appender.console.maxSize = 1G
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{ISO8601} %-5p [%t] %C{2}(%L): %m%n
+
+rootLogger = DEBUG,Console
+
+#TODO review these settings
+log4j.logger.org.apache.hadoop=WARN
+log4j.logger.org.apache.zookeeper=ERROR
+log4j.logger.org.apache.hadoop.hbase=DEBUG
+
+logger.hadoop.name = org.apache.hadoop
+logger.hadoop.level = WARN
+
+logger.zookeeper.name = org.apache.zookeeper
+logger.zookeeper.level = ERROR
+
+logger.hbase.name = apache.hadoop.hbase
+logger.hbase.level = DEBUG
diff --git a/phoenix-core/src/it/resources/log4j2-test.xml b/phoenix-core/src/it/resources/log4j2-test.xml
deleted file mode 100644
index 3c021be5f7..0000000000
--- a/phoenix-core/src/it/resources/log4j2-test.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.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.
--->
-<Configuration name="Log4j1">
-  <Properties>
-    <Property name="hbase.log.dir">.</Property>
-    <Property name="hbase.log.file">hbase.log</Property>
-    <Property name="hbase.root.logger">DEBUG,console</Property>
-  </Properties>
-  <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
-      <PatternLayout
-        pattern="%d %-5p [%t] %C{2}(%L): %m%n" />
-    </Console>
-    <RollingFile name="DRFA" fileName="./hbase.log"
-      filePattern="./hbase.log%d{.yyyy-MM-dd}">
-      <PatternLayout
-        pattern="%d %-5p [%t] %C{2}(%L): %m%n" />
-      <Policies>
-        <TimeBasedTriggeringPolicy
-          modulate="true" />
-      </Policies>
-      <DefaultRolloverStrategy max="2147483647" />
-    </RollingFile>
-  </Appenders>
-  <Loggers>
-    <Root level="DEBUG">
-      <AppenderRef ref="console" />
-    </Root>
-    <Logger name="org.apache.zookeeper" level="ERROR" />
-    <Logger name="org.apache.hadoop" level="WARN" />
-    <Logger name="org.apache.hadoop.hbase" level="DEBUG" />
-  </Loggers>
-</Configuration>
\ No newline at end of file
diff --git a/phoenix-core/src/test/resources/log4j.properties b/phoenix-core/src/test/resources/log4j.properties
deleted file mode 100644
index 85706b45c3..0000000000
--- a/phoenix-core/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,65 +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.
-
-# Define some default values that can be overridden by system properties
-hbase.root.logger=DEBUG,console
-hbase.log.dir=.
-hbase.log.file=hbase.log
-
-# Define the root logger to the system property "hbase.root.logger".
-log4j.rootLogger=${hbase.root.logger}
-
-# Logging Threshold
-log4j.threshhold=ALL
-
-#
-# Daily Rolling File Appender
-#
-log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.DRFA.File=${hbase.log.dir}/${hbase.log.file}
-
-# Rollver at midnight
-log4j.appender.DRFA.DatePattern=.yyyy-MM-dd
-
-# 30-day backup
-#log4j.appender.DRFA.MaxBackupIndex=30
-log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout
-
-# Pattern format: Date LogLevel LoggerName LogMessage
-#log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
-
-# Debugging Pattern format
-log4j.appender.DRFA.layout.ConversionPattern=%d %-5p [%t] %C{2}(%L): %m%n
-
-
-#
-# console
-# Add "console" to rootlogger above if you want to use this
-#
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.target=System.err
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d %-5p [%t] %C(%L): %m%n
-
-# Custom Logging levels
-
-#log4j.logger.org.apache.hadoop.fs.FSNamesystem=DEBUG
-log4j.logger.org.mortbay.log=WARN
-log4j.logger.org.apache.hadoop=WARN
-log4j.logger.org.apache.zookeeper=ERROR
-log4j.logger.org.apache.hadoop.hbase=DEBUG
-log4j.logger.org.apache.directory=WARN
-log4j.logger.net.sf.ehcache=WARN
diff --git a/phoenix-core/src/test/resources/log4j2-test.properties b/phoenix-core/src/test/resources/log4j2-test.properties
new file mode 100644
index 0000000000..b1c708cc06
--- /dev/null
+++ b/phoenix-core/src/test/resources/log4j2-test.properties
@@ -0,0 +1,50 @@
+#/**
+# * 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.
+# */
+
+status = debug
+dest = err
+name = PropertiesConfig
+packages = org.apache.hadoop.hbase.logging
+
+appender.console.type = Console
+appender.console.target = SYSTEM_ERR
+appender.console.name = Console
+appender.console.maxSize = 1G
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{ISO8601} %-5p [%t] %C{2}(%L): %m%n
+
+rootLogger = DEBUG,Console
+
+# TODO review settings below
+logger.mortbay.name = org.mortbay.log
+logger.mortbay.name = WARN
+
+logger.hadoop.name = org.apache.hadoop
+logger.hadoop.level = WARN
+
+logger.zookeeper.name = org.apache.zookeeper
+logger.zookeeper.level = ERROR
+
+logger.hbase.name = apache.hadoop.hbase
+logger.hbase.level = DEBUG
+
+logger.directory.name = org.apache.directory
+logger.directory.level = WARN
+
+logger.ehcache.name = net.sf.ehcache
+logger.ehcache.level = WARN
diff --git a/phoenix-core/src/test/resources/log4j2-test.xml b/phoenix-core/src/test/resources/log4j2-test.xml
deleted file mode 100644
index a7d890f28f..0000000000
--- a/phoenix-core/src/test/resources/log4j2-test.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.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.
--->
-<Configuration name="Log4j1">
-  <Properties>
-    <Property name="hbase.log.dir">.</Property>
-    <Property name="hbase.log.file">hbase.log</Property>
-    <Property name="hbase.root.logger">DEBUG,console</Property>
-  </Properties>
-  <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
-      <PatternLayout pattern="%d %-5p [%t] %C(%L): %m%n" />
-    </Console>
-    <RollingFile name="DRFA" fileName="./hbase.log"
-      filePattern="./hbase.log%d{.yyyy-MM-dd}">
-      <PatternLayout
-        pattern="%d %-5p [%t] %C{2}(%L): %m%n" />
-      <Policies>
-        <TimeBasedTriggeringPolicy
-          modulate="true" />
-      </Policies>
-      <DefaultRolloverStrategy max="2147483647" />
-    </RollingFile>
-  </Appenders>
-  <Loggers>
-    <Root level="DEBUG">
-      <AppenderRef ref="console" />
-    </Root>
-    <Logger name="org.apache.hadoop.hbase" level="DEBUG" />
-    <Logger name="org.mortbay.log" level="WARN" />
-    <Logger name="org.apache.zookeeper" level="ERROR" />
-    <Logger name="net.sf.ehcache" level="WARN" />
-    <Logger name="org.apache.hadoop" level="WARN" />
-    <Logger name="org.apache.directory" level="WARN" />
-  </Loggers>
-</Configuration>
\ No newline at end of file
diff --git a/phoenix-pherf/config/log4j2.properties b/phoenix-pherf/config/log4j2.properties
new file mode 100644
index 0000000000..7d4b722f13
--- /dev/null
+++ b/phoenix-pherf/config/log4j2.properties
@@ -0,0 +1,67 @@
+#/**
+# * 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.
+# */
+
+# This config is used by sqlline, pherf and psql, even though the 
+
+status = warn
+dest = err
+name = PropertiesConfig
+
+# Console appender
+appender.console.type = Console
+appender.console.target = SYSTEM_ERR
+appender.console.name = console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{ISO8601} %-5p [%t] %c{2}: %.1000m%n
+
+# Not used by default
+# Daily Rolling File Appender
+appender.DRFA.type = RollingFile
+appender.DRFA.name = DRFA
+appender.DRFA.fileName = ${sys:psql.log.dir:-.}/${sys:psql.log.file:-psql.log}
+appender.DRFA.filePattern = ${sys:psql.log.dir:-.}/${sys:psql.log.file:-psql.log}.%d{yyyy-MM-dd}
+appender.DRFA.createOnDemand = true
+appender.DRFA.layout.type = PatternLayout
+appender.DRFA.layout.pattern = %d{ISO8601} %-5p [%t] %c{2}: %.1000m%n
+appender.DRFA.policies.type = Policies
+appender.DRFA.policies.time.type = TimeBasedTriggeringPolicy
+appender.DRFA.policies.time.interval = 1
+appender.DRFA.policies.time.modulate = true
+appender.DRFA.policies.size.type = SizeBasedTriggeringPolicy
+appender.DRFA.policies.size.size = ${sys:psql.log.maxfilesize:-256MB}
+appender.DRFA.strategy.type = DefaultRolloverStrategy
+appender.DRFA.strategy.max = ${sys:psql.log.maxbackupindex:-20}
+
+# Null Appender
+appender.NullAppender.type = Null
+appender.NullAppender.name = NullAppender
+
+rootLogger = ${sys:psql.root.logger:-INFO,console}
+
+# Custom Logging levels
+logger.zookeeper.name = org.apache.zookeeper
+logger.zookeeper.level = ERROR
+
+logger.hbase_zk_rzk.name = org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper
+logger.hbase_zk_rzk.level = ERROR
+
+logger.hbase_zk_zku.name = org.apache.hadoop.hbase.zookeeper.ZKUtil
+logger.hbase_zk_zku.level = ERROR
+
+logger.hbase_conf.name = org.apache.hadoop.hbase.HBaseConfiguration
+logger.hbase_conf.level = ERROR
diff --git a/phoenix-pherf/config/log4j2.xml b/phoenix-pherf/config/log4j2.xml
deleted file mode 100644
index a9526f4c96..0000000000
--- a/phoenix-pherf/config/log4j2.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.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.
--->
-<Configuration name="Log4j1">
-  <ThresholdFilter onMatch="NEUTRAL" onMismatch="DENY"
-    level="INFO" />
-  <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
-      <PatternLayout
-        pattern="%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n" />
-    </Console>
-    <Null name="NullAppender" />
-    <RollingFile name="DRFA" fileName="pherf.log"
-      filePattern="pherf.log%d{.yyyy-MM-dd}">
-      <PatternLayout pattern="%d{ISO8601} %p %c: %m%n" />
-      <Policies>
-        <TimeBasedTriggeringPolicy
-          modulate="true" />
-      </Policies>
-      <DefaultRolloverStrategy max="2147483647" />
-    </RollingFile>
-  </Appenders>
-  <Loggers>
-    <Root level="INFO">
-      <AppenderRef ref="console" />
-    </Root>
-    <Logger name="org.apache.hadoop.hbase.zookeeper.ZKUtil"
-      level="ERROR" />
-    <Logger name="org.apache.zookeeper" level="ERROR" />
-    <Logger name="org.apache.hadoop.hbase.HBaseConfiguration"
-      level="ERROR" />
-    <Logger
-      name="org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper"
-      level="ERROR" />
-  </Loggers>
-</Configuration>
\ No newline at end of file