logging into different files #201
-
Sorry if this is a silly question, but I might have missed something very obvious... My Sidekiq is currently set to log to a separate log file, set inside the Even if it ignores the config, is there a way to tell SemanticLogger to log sidekiq log output into one file, and other rails log output into another? I tried to probe What am I missing? :) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Correct, by design Semantic Logger writes all log messages to the same file (appenders). This becomes more relevant when you move up to a centralized logging solution so that all the log entries can be alerted on or searched centrally. If you really want to log to 2 different files, that can be done by using 2 file logging appenders pointing to 2 different files. On the first log file appender add a filter to exclude all Sidekiq log messages. On the second log file appender add a filter that only includes Sidekiq log messages. https://rocketjob.github.io/semantic_logger/filtering.html With a single log file it is simple to use grep to include or exclude all Sidekiq messages when viewing the log files. Exclude Sidekiq: Sidekiq only: |
Beta Was this translation helpful? Give feedback.
-
Thanks for clarifying, @reidmorrison. I was just wondering if there was an option I was missing. Nothing wrong with consolidating logs, and I agree it's easy to grep/match based on certain patterns in one log file. It's just that currently our logs are split, so I'm trying to keep things "compatible" if we switch over to SemanticLogger. At least at first. But I don't see any real downside to having them all in one log. Using the SemanticLogger filters seems awkward to me in this case, and probably adds unnecessary load. So I would just use one log file. |
Beta Was this translation helpful? Give feedback.
-
I'll close this, since my question was answered. Thanks again @reidmorrison |
Beta Was this translation helpful? Give feedback.
Correct, by design Semantic Logger writes all log messages to the same file (appenders). This becomes more relevant when you move up to a centralized logging solution so that all the log entries can be alerted on or searched centrally.
If you really want to log to 2 different files, that can be done by using 2 file logging appenders pointing to 2 different files.
On the first log file appender add a filter to exclude all Sidekiq log messages. On the second log file appender add a filter that only includes Sidekiq log messages. https://rocketjob.github.io/semantic_logger/filtering.html
With a single log file it is simple to use grep to include or exclude all Sidekiq messages when viewing t…