Comments (2)
Hi @reidmorrison ! A question about your doc of log rotation.
Logrotate manual clearly states that copytruncate
option may lead to some data losses due to the fact that there might be a delay between copy and truncate. Your doc seems to indicate the opposite.
I know you probably ment that's the best way to rotate semantic logger logs, but I think it could be missleading for someone that doesn't fully understand the underlying mechanism. Do you think the doc could be improved to be a bit more clear regarding this? (at least a comment referring to logrotate doc).
On a related matter, have you thought of adding some easy way to reopen logs on a signal (like HUP
)? (if you want I can open an issue to discuss this feature)
from semantic_logger.
Linux has exceptional support for log rotation using logrotate
.
For example for log rotation on a daily basis, create a file called /etc/logrotate.d/my_app
/var/www/rails/my_app/log/*.log {
daily
missingok
copytruncate
rotate 14
compress
delaycompress
notifempty
}
This log rotation example is based on log file size and is useful if the application is logging a lot of data, or if you want several days in one log file for low traffic sites:
/var/www/rails/my_app/log/*.log {
size 2G
missingok
copytruncate
rotate 7
compress
nodelaycompress
notifempty
dateformat .%Y%m%d
}
Other log rotation tools are also available, the only requirement from a Semantic Logger perspective is that the files must be rotated using copy-truncate to ensure that no data is lost during log rotation.
from semantic_logger.
Related Issues (20)
- Default formatter doesn't return context by default. HOT 1
- Semantic Logger removes keys from hash passed to loggers
- Support message and payload (v5 feature request) HOT 7
- Cannot use Sentry.init properly with sentry-ruby appender HOT 2
- Add support for New Relic log forwarding feature HOT 9
- Elasticsearch Specifying types in bulk requests is deprecated HOT 4
- Log level signal trap omits :fatal and :error levels HOT 2
- Suggestion: Change Loggable logger initialization from lazy to eager HOT 5
- RSpec test suite hangs intermittently unless `sync!` has been called HOT 1
- SemanticLogger.sync! is Not Thread-Safe
- Semantic Logger + Sidekiq 7 HOT 3
- Exception on `logger.error({ payload: '', foo: 'bar' })` (trying to log an arbitrary hash with `payload` key) HOT 1
- HTTP appender / Possible to write custom Headers HOT 1
- Segmentation fault in Formatters::Base for async appender HOT 2
- Improve CaptureLogEvents test logger HOT 1
- Error is raised when logging first occurs in a signal trap
- Base formatter time_format docs and behavior conflict, with no way to initialize it to nil in the ctor.
- Calling 'reopen' and Adding an Appender Creates 2 Logging Threads HOT 2
- Release Version 4.13 HOT 1
- Intermittent `NameError`/`LoadError` when loading Rails environment HOT 3
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 semantic_logger.