Skip to content

Commit

Permalink
Remove application name config from logs and move log configuration
Browse files Browse the repository at this point in the history
Application name is blank so is an useless configuration
  • Loading branch information
tomas-stefano committed Nov 18, 2024
1 parent 0fe3fe4 commit ae5315c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,8 @@ class Application < Rails::Application

config.exceptions_app = routes
config.active_job.queue_adapter = :sidekiq

config.log_tags = [:request_id]
config.log_level = Settings.log_level
end
end
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
config.semantic_logger.add_appender(
io: $stdout,
level: config.log_level,
formatter: config.rails_semantic_logger.format,
formatter: config.rails_semantic_logger.format
)

config.active_record.logger = nil # Don't log SQL in production
Expand Down
12 changes: 5 additions & 7 deletions config/initializers/semantic_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ def method_is_post_or_put_or_patch?
end

unless Rails.env.local?
Rails.application.configure do
config.semantic_logger.application = Settings.application_name
config.log_tags = [:request_id]
config.log_level = Settings.log_level
end

SemanticLogger.add_appender(io: $stdout, level: Settings.log_level, formatter: CustomLogFormatter.new)
SemanticLogger.add_appender(
io: $stdout,
level: Rails.application.config.log_level,
formatter: CustomLogFormatter.new
)
Rails.application.config.logger.info('Application logging to STDOUT')
end

0 comments on commit ae5315c

Please sign in to comment.