4 ms·
Generally you're right. To know what will be helpful for debugging you have to know what will go wrong, and if you know what will go wrong you may as well fix
by cconstantine 18y ago
Generally you're right. To know what will be helpful for debugging you have to know what will go wrong, and if you know what will go wrong you may as well fix it now instead of after it affects a user. Also, in any sufficiently stable system errors become very hard to reproduce so you may not have the luxury of reproducing the error before finding the root cause of the problem.
Large log files don't scare me for I have The Shield of Grep, and The Sword of Awk.
The only issue I've seen with logging everything is that some file systems have troubles with files larger than 2gigs, and changing file systems may not be an option. Depending on how quickly you rotate your logs you can hit that limit and stop logging messages or cause errors elsewhere. With a log rotation period of 1 hour I've hit this limit, and it's rather annoying.
- DenisM 18y agoWhy not rotate log files based on size?
- cconstantine 18y agoNo real reason except that it works the way it does. It would take time to change it, and there is more pressing work to be done. That, and I don't work for the company that had/has this problem anymore.
- cconstantine 18y agoA better idea may be to not log to file. If you were to log to a database you could record things like date/time, session_id, service_name, module_name, and a generic message and do clever SELECTs on your database of events/messages and it would be easier to answer questions like 'Is this exception clustered with time?' or 'is module X ever called in a session that results in an error between noon and 1pm?' Cleaning old messages is potentially easier as you can remove lower priority messages first, or simply delete any message older than X. Of course, if you're logging to another remote service (like a DB server), how do you record low level events in communicating with that service, or how do you record events when the db server is down?
- joestrickler 18y agoLog critical/connectivity errors to a local disk.