Git Product home page Git Product logo

Comments (2)

jbarreneche avatar jbarreneche commented on June 14, 2024 1

Hi @reidmorrison ! A question about your doc of log rotation.

Logrotate manual clearly states that copytruncate option may lead to some data losses due to the fact that there might be a delay between copy and truncate. Your doc seems to indicate the opposite.
I know you probably ment that's the best way to rotate semantic logger logs, but I think it could be missleading for someone that doesn't fully understand the underlying mechanism. Do you think the doc could be improved to be a bit more clear regarding this? (at least a comment referring to logrotate doc).

On a related matter, have you thought of adding some easy way to reopen logs on a signal (like HUP)? (if you want I can open an issue to discuss this feature)

from semantic_logger.

reidmorrison avatar reidmorrison commented on June 14, 2024

Linux has exceptional support for log rotation using logrotate.

For example for log rotation on a daily basis, create a file called /etc/logrotate.d/my_app

/var/www/rails/my_app/log/*.log {
        daily
        missingok
        copytruncate
        rotate 14
        compress
        delaycompress
        notifempty
}

This log rotation example is based on log file size and is useful if the application is logging a lot of data, or if you want several days in one log file for low traffic sites:

/var/www/rails/my_app/log/*.log {
        size 2G
        missingok
        copytruncate
        rotate 7
        compress
        nodelaycompress
        notifempty
        dateformat .%Y%m%d
}

Other log rotation tools are also available, the only requirement from a Semantic Logger perspective is that the files must be rotated using copy-truncate to ensure that no data is lost during log rotation.

from semantic_logger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.