Updated Branches:
  refs/heads/flume-1.4 9691e3639 -> eb46fe93a

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/eb46fe93
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/eb46fe93
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/eb46fe93

Branch: refs/heads/flume-1.4
Commit: eb46fe93a3af9dd113bc2f798bd0ef6361ae8dab
Parents: 9691e36
Author: Mike Percy <[email protected]>
Authored: Sun Jun 23 13:28:00 2013 -0700
Committer: Mike Percy <[email protected]>
Committed: Sun Jun 23 13:28:33 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/eb46fe93/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/eb46fe93/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/eb46fe93/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>

Reply via email to