Comments (1)
@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., compressprefix.1
and store toprefix.1.gz
then deleteprefix.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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rolling-file-rs.