LoggerAppenderRollingFile: Fixed bug which prevented compression from working on...
authorIvan Habunek <ihabunek@apache.org>
Sun, 6 May 2012 11:38:35 +0000 (11:38 +0000)
committerIvan Habunek <ihabunek@apache.org>
Sun, 6 May 2012 11:38:35 +0000 (11:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/logging/log4php/trunk@1334608 13f79535-47bb-0310-9956-ffa450edef68

src/main/php/appenders/LoggerAppenderRollingFile.php

index 3d2ec37..ca6040e 100644 (file)
@@ -138,7 +138,7 @@ class LoggerAppenderRollingFile extends LoggerAppenderFile {
                        $this->renameArchievedLogs($fileName);
        
                        if (true === $this->compress) {
-                               file_put_contents('compress.zlib:///'.$fileName.'.1.gz', file_get_contents($fileName));
+                               file_put_contents('compress.zlib://'.$fileName.'.1.gz', file_get_contents($fileName));
                        } else {
                                // Backup the active file
                                copy($fileName, "$fileName.1");                         
@@ -246,10 +246,9 @@ class LoggerAppenderRollingFile extends LoggerAppenderFile {
        public function activateOptions() {
                parent::activateOptions();
                
-               if ($this->compress == true && !function_exists('gzcompress')) {
+               if ($this->compress == true && !extension_loaded('zlib')) {
+                       $this->warn('The zlib extension is required for file-compression');
                        $this->closed = true;
-                       
-                       $this->warn('zlib is required for file-compression');
                }
        }