You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flume.apache.org by mp...@apache.org on 2013/06/23 22:28:41 UTC

git commit: FLUME-1874. Ship with log4j.properties file that has a reliable time based rolling policy.

Updated Branches:
  refs/heads/trunk 97170aebf -> 2f90fd8b0


FLUME-1874. Ship with log4j.properties file that has a reliable time based rolling policy.

(Mike Percy)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/2f90fd8b
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/2f90fd8b
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/2f90fd8b

Branch: refs/heads/trunk
Commit: 2f90fd8b08bfda9c7b41d2f7a2ac03da10d6f057
Parents: 97170ae
Author: Mike Percy <mp...@apache.org>
Authored: Sun Jun 23 13:28:00 2013 -0700
Committer: Mike Percy <mp...@apache.org>
Committed: Sun Jun 23 13:28:00 2013 -0700

----------------------------------------------------------------------
 conf/log4j.properties | 24 ++++++++++++++++--------
 flume-ng-node/pom.xml |  5 +++++
 pom.xml               |  6 ++++++
 3 files changed, 27 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/2f90fd8b/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/conf/log4j.properties b/conf/log4j.properties
index e5db338..3918511 100644
--- a/conf/log4j.properties
+++ b/conf/log4j.properties
@@ -36,11 +36,9 @@ log4j.logger.org.apache.hadoop = INFO
 # Define the root logger to the system property "flume.root.logger".
 log4j.rootLogger=${flume.root.logger}
 
-#
-# Rolling file appender
-# Default log rotation configuration
-#
 
+# Stock log4j rolling file appender
+# Default log rotation configuration
 log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
 log4j.appender.LOGFILE.MaxFileSize=100MB
 log4j.appender.LOGFILE.MaxBackupIndex=10
@@ -48,11 +46,21 @@ log4j.appender.LOGFILE.File=${flume.log.dir}/${flume.log.file}
 log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
 log4j.appender.LOGFILE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-5p [%t] (%C.%M:%L) %x - %m%n
 
-#
-# console
-# Add "console" to rootlogger above if you want to use this
-#
 
+# Warning: If you enable the following appender it will fill up your disk if you don't have a cleanup job!
+# This uses the updated rolling file appender from log4j-extras that supports a reliable time-based rolling policy.
+# See http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/TimeBasedRollingPolicy.html
+# Add "DAILY" to flume.root.logger above if you want to use this
+log4j.appender.DAILY=org.apache.log4j.rolling.RollingFileAppender
+log4j.appender.DAILY.rollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy
+log4j.appender.DAILY.rollingPolicy.ActiveFileName=${flume.log.dir}/${flume.log.file}
+log4j.appender.DAILY.rollingPolicy.FileNamePattern=${flume.log.dir}/${flume.log.file}.%d{yyyy-MM-dd}
+log4j.appender.DAILY.layout=org.apache.log4j.PatternLayout
+log4j.appender.DAILY.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-5p [%t] (%C.%M:%L) %x - %m%n
+
+
+# console
+# Add "console" to flume.root.logger 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

http://git-wip-us.apache.org/repos/asf/flume/blob/2f90fd8b/flume-ng-node/pom.xml
----------------------------------------------------------------------
diff --git a/flume-ng-node/pom.xml b/flume-ng-node/pom.xml
index 0d1b725..5cdd9e2 100644
--- a/flume-ng-node/pom.xml
+++ b/flume-ng-node/pom.xml
@@ -108,6 +108,11 @@
     </dependency>
 
     <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>apache-log4j-extras</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/flume/blob/2f90fd8b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b0c1a76..6846b07 100644
--- a/pom.xml
+++ b/pom.xml
@@ -686,6 +686,12 @@ limitations under the License.
       </dependency>
 
       <dependency>
+        <groupId>log4j</groupId>
+        <artifactId>apache-log4j-extras</artifactId>
+        <version>1.1</version>
+      </dependency>
+
+      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api</artifactId>
         <version>1.6.1</version>