Browse files

HIVE-1855 Include Process ID in the log4j log file name

(Ning Zhang via namit)



git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1051359 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent b80bdf9 commit 6b775d160a4dc74d7ef1cd5acd412dec9de4b8bb Namit Jain committed Dec 21, 2010
View
3 CHANGES.txt
@@ -311,6 +311,9 @@ Trunk - Unreleased
HIVE-1415: add CLI command for executing a SQL script
(Edward Capriolo via jvs)
+ HIVE-1855 Include Process ID in the log4j log file name
+ (Ning Zhang via namit)
+
OPTIMIZATIONS
BUG FIXES
View
5 conf/hive-log4j.properties
@@ -12,8 +12,13 @@ log4j.threshhold=WARN
#
# Daily Rolling File Appender
#
+# Use the PidDailyerRollingFileAppend class instead if you want to use separate log files
+# for different CLI session.
+#
+# log4j.appender.DRFA=org.apache.hadoop.hive.ql.log.PidDailyRollingFileAppender
log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
+
log4j.appender.DRFA.File=${hive.log.dir}/${hive.log.file}
# Rollver at midnight
View
2 eclipse-templates/.classpath
@@ -25,7 +25,7 @@
<classpathentry exported="true" kind="lib" path="ql/lib/antlr-@antlr.version@.jar"/>
<classpathentry exported="true" kind="lib" path="ql/lib/antlr-runtime-@antlr-runtime.version@.jar"/>
<classpathentry exported="true" kind="lib" path="testlibs/junit-@junit.version@.jar"/>
- <classpathentry kind="lib" path="build/dist/lib/jdo-api-@jdo-api.version@.jar"/>
+ <classpathentry kind="lib" path="build/dist/lib/jdo2-api-@jdo-api.version@.jar"/>
<classpathentry kind="lib" path="build/dist/lib/datanucleus-core-@datanucleus-core.version@.jar"/>
<classpathentry kind="lib" path="build/dist/lib/datanucleus-enhancer-@datanucleus-enhancer.version@.jar"/>
<classpathentry kind="lib" path="build/dist/lib/datanucleus-rdbms-@datanucleus-rdbms.version@.jar"/>
View
33 ql/src/java/org/apache/hadoop/hive/ql/log/PidDailyRollingFileAppender.java
@@ -0,0 +1,33 @@
+/**
+ * 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.hadoop.hive.ql.log;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+
+import org.apache.log4j.DailyRollingFileAppender;
+
+public class PidDailyRollingFileAppender extends DailyRollingFileAppender {
+
+ @Override
+ public void setFile(String file) {
+ RuntimeMXBean rt = ManagementFactory.getRuntimeMXBean();
+ super.setFile(file + '.' + rt.getName());
+ }
+}

0 comments on commit 6b775d1

Please sign in to comment.