Building logrotation into your logging library #programming
.... don't. Just. Don't.
Instead: reopen any open logfiles if you receive a SIGHUP, and let programs like logrotate take care of the rotation.
This is regardless of whether you're a Java library, a Haskell one, or something else.
And never, ever, just don't, rotate the logfile on startup.
If you are running
tail -f on the log file while restarting the
service and get no feedback, you've been hit by this bad behaviour.
(Yes, you can use
-F but you shouldn't have to. Just sayin'.)
In case you are using something that logs to stdout and doesn't reopen on SIGHUP, timestampit is your friend - just pipe the output through it, and bob's your uncle.
To avoid spam many websites make you fill out a CAPTCHA, or log in via an account at a corporation such as Twitter, Facebook, Google or even Microsoft GitHub.
I have chosen to use a more old school method of spam prevention.
To post a comment here, you need to:
¹ Such as Thunderbird, Pan, slrn, tin or Gnus (part of Emacs).
- Configure a newsreader¹ to connect to the server
- Open the newsgroup called
1119using nntps (nntp over TLS).
lantern.koldfrontand post a follow up to the article.
Or, you can fill in this form: