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 "Florian Semm (Created) (JIRA)" <ji...@apache.org> on 2011/11/29 13:23:40 UTC

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

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.3
            Reporter: Florian Semm
             Fix For: 2.3


rotated files at the moment look like this: file.log.1

with compression: file.log.1.zip / file.log.1.gz

--
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

        

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

Posted by "Florian Semm (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Florian Semm updated LOG4PHP-164:
---------------------------------

    Description: 
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

  was:
rotated files at the moment look like this: file.log.1

with compression: file.log.1.zip / file.log.1.gz

    
> 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.3
>            Reporter: Florian Semm
>             Fix For: 2.3
>
>
> 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

        

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

Posted by "Ivan Habunek (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ivan Habunek updated LOG4PHP-164:
---------------------------------

             Priority: Minor  (was: Major)
    Affects Version/s:     (was: 2.3)
                       2.1

I agree with the general idea. A couple of thoughts:
1. Make compression optional since it uses up resources
2. The simplest way (load log file, compress, save) can use up all memory if the file is big. Compression should be done in chunks or use streams.
3. Maybe we can add an option to log to a compressed file right away. It is possible by using compression stream wrappers, for example:
file_put_contents('compress.zlib://data.gz', $data, FILE_APPEND);
This way we don't have to compress large files on rollover.

Just some thing to think about...
                
> 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
>            Reporter: Florian Semm
>            Priority: Minor
>             Fix For: 2.3
>
>
> 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

        

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

Posted by "Sven Rautenberg (JIRA)" <ji...@apache.org>.
    [ 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

        

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

Posted by "Ivan Habunek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ivan Habunek closed LOG4PHP-164.
--------------------------------

    Resolution: Fixed
    
> 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

        

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

Posted by "Ivan Habunek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4PHP-164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13437530#comment-13437530 ] 

Ivan Habunek commented on LOG4PHP-164:
--------------------------------------

I have modified the compression procedure to work in chunks of 100KB. This should keep memory consumption under control. Still, it takes some time to compress larger files, but this is not easily fixable.
                
> 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

        

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

Posted by "Florian Semm (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4PHP-164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13168192#comment-13168192 ] 

Florian Semm commented on LOG4PHP-164:
--------------------------------------

My first implementation-idea was to use Zip-Class [1]. Are there any differences between a stream-compression and this core-lib?

I think it's known that the compression of a 100mb file slow down the system. So you should think twice to use it.

[1] http://php.net/manual/en/book.zip.php
                
> 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
>            Reporter: Florian Semm
>            Priority: Minor
>             Fix For: 2.3
>
>
> 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

        

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

Posted by "Florian Semm (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Florian Semm updated LOG4PHP-164:
---------------------------------

    Attachment: log4php.patch

I have added an option "compress". This option triggers the compression with gzip via file-stream.

I have also modified and refactored the testclass for the rollingfile-appender.
                
> 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
>            Reporter: Florian Semm
>            Priority: Minor
>             Fix For: 2.3
>
>         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