Code Monkey home page Code Monkey logo

Comments (1)

kevinhoffman avatar kevinhoffman commented on August 26, 2024

@lilyball - it's a nice idea. apologies on the delay not much time to spend on this lately. I would envision the order during rotation to be slightly different:

  • Rotate the file as it currently happens and continue writes to the new file -- do this as quickly as possible to not block logging (compression could take a while on large logs).
  • Trigger some "file just got rotated" callback (provided to the RollingFileAppender) that accepts the full path of the recently rotated file where the caller could do some desired logic, e.g., schedule some async work to compress the contents of the recently rotated file and write it to an alternate prefix (e.g., compress prefix.1 and store to prefix.1.gz then delete prefix.1)

RollingFileAppender would also need to be enhanced to receive an optional additional suffix to check when it's rotating files so that it would properly rotate files that had the uncompressed or the compressed prefix.

This strategy would allow the application to implement any arbitrary compression/post-processing of logs and keep decisions on whether to do it synchronously or asynchronously and what compression algo to use outside the scope of the module. If the caller chose to process compression asynchronously outside of the callback there could be a race condition if the logfile is rotating fast enough, but it seems like that would be an acceptable edge case. What do you think?

from rolling-file-rs.

Related Issues (2)

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.