Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How much should katip support log rotation? #5

Open
MichaelXavier opened this issue Feb 29, 2016 · 3 comments
Open

How much should katip support log rotation? #5

MichaelXavier opened this issue Feb 29, 2016 · 3 comments
Labels

Comments

@MichaelXavier
Copy link
Collaborator

Some logging utilities actually manage log rotation for you. Others simply provide hooks for reopening handles on certain signals so external log rotators can do the rotation and signal to the process when to reopen. Is this something katip should do? There's also the question of a generalized rotation strategy, as rotating elasticsearch logs has also turned out to be important in the real world.

I'm of the opinion that katip shouldn't be responsible for rotation. At a certain point I think log libraries just start reimplementing buggy, less robust log rotation features when there's already easy to use tools available (such as logrotate). I don't see any benefit for us trying to do logrotation other than the convenience of specifying rotation schedules alongside other log settings when using katip. This is achievable by other means.

@ozataman
Copy link
Member

My thought on this has always been that we'd have a separate backend - basically an enhanced Handle backend- that, among other things, would also take care of rotation.

The ability to signal from the outside though might be worth looking into. If it's real easy, we could bake it into the basic Handle backend as well.

@MichaelXavier
Copy link
Collaborator Author

I could see that being contributed. For reopening logs I usually use copytruncate in logrotate which seems to eliminate the need to reopen. The challenge with adding reopening to the current handle scribe is it gets passed a pre-opened Handle, so it can't reopen it because it doesn't know the file to open.

@sopvop
Copy link
Contributor

sopvop commented Jun 21, 2016

If GHC.IO.hDuplicateTo is atomic, then reopening logs from outside is not a problem.
If it isn't, then you'll need some kind of locking, like taking MVar Handle instead of just Handle.

But that would require some kind of queue for messages for good efficiency, so you can log messages in batches, like the one in logging-effect package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants