You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by "Sven Rautenberg (JIRA)" <ji...@apache.org> on 2012/06/23 13:22:42 UTC

[jira] [Commented] (LOG4PHP-164) Compress rotated files with Gzip/Zip

    [ https://issues.apache.org/jira/browse/LOG4PHP-164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399914#comment-13399914 ] 

Sven Rautenberg commented on LOG4PHP-164:
-----------------------------------------

I must say that I do not really like the idea, nor the current implementation.

The idea has its drawbacks on unexpectedly using a lot of resources for compression when only simple and performant logging was asked, but this is completely in the hand of the developer who configures his wishes. So be it. :)

The implementation though is lacking. I see this line in the patch file which seems to do the work:

+			if (true === $this->compress) {
+				file_put_contents('compress.zlib:///'.$fileName.'.1.gz', file_get_contents($fileName));
+			}

Ugh! Reading the whole file into memory and the writing it back to the hard drive! This is no problem with a 100 byte test file, but using it on 100 MB log files will most likely blow something up.

Using some kind of gzip shell command would be much nicer here, but I understand this to be too system-dependant.

What happens to the uncompressed file, by the way?
                
> Compress rotated files with Gzip/Zip
> ------------------------------------
>
>                 Key: LOG4PHP-164
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-164
>             Project: Log4php
>          Issue Type: New Feature
>          Components: Code
>    Affects Versions: 2.1.0
>            Reporter: Florian Semm
>            Priority: Minor
>             Fix For: 2.3.0
>
>         Attachments: log4php.patch
>
>
> rotated files at the moment look like this: file.log.1
> with compression: file.log.1.zip / file.log.1.gz
> php has a simple api for that: http://php.net/manual/de/book.zip.php

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira