You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, I want to mute Sending N messages to ... logged at info level by ruby-kafka,
while keeping logging info messages from other places.
For some use-cases, this may be treated as a liveness check.
While in others it produces a bunch of messages, which not only wastes space but makes reading logs harder (especially when there is some other metrics mechanism included
or other app-oriented logs).
And this way skip messages at :info. Other loggers, could still log :info messages.
logger.level=:warn
or only change level to a warning if keeping logs at info but keep if debug is set:
logger.level=:warniflogger.info?
Quite a drastic option, as there are other useful logs you may like to see on production.
Filter unwanted logs
Define what you want to filter (in this case means what to select - show in the logs)
logger.filter=lambdado |log|
returntrueunlesslog.message
!log.message.match?(/\ASending \d messages to /)end
This gives you more control over what you want to mute.
Also in this case I'd not set this filter when the main logger (like Rails.logger) is set to :debug level.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
For example, I want to mute
Sending N messages to ...
logged atinfo
level byruby-kafka
,while keeping logging
info
messages from other places.For some use-cases, this may be treated as a liveness check.
While in others it produces a bunch of messages, which not only wastes space but makes reading logs harder (especially when there is some other metrics mechanism included
or other app-oriented logs).
For those still wanting to mute this (and if they use https://github.com/reidmorrison/semantic_logger),
it's possible to configure a custom logger for the library:
Log at
:warn
levelAnd this way skip messages at
:info
. Other loggers, could still log:info
messages.or only change level to a warning if keeping logs at
info
but keep ifdebug
is set:Quite a drastic option, as there are other useful logs you may like to see on production.
Filter unwanted logs
Define what you want to filter (in this case means what to
select
- show in the logs)This gives you more control over what you want to mute.
Also in this case I'd not set this filter when the main logger (like
Rails.logger
) is set to:debug
level.Links:
Beta Was this translation helpful? Give feedback.
All reactions