Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
production: make the log level configurable
Browse files Browse the repository at this point in the history
With this commit administrators will be able to set the log level of
their Portus instance through the `PORTUS_LOG_LEVEL`. This will be
possible in production and staging, and it's meant to be used in
exceptional cases (e.g. something is really wrong with the `crono`
process and the administrator wants to restart it with `debug` mode for
a while).

Signed-off-by: Miquel Sabaté Solà <[email protected]>
  • Loading branch information
mssola committed Aug 2, 2017
1 parent d556236 commit db2403f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ points if your issue is about Portus behaving in an unexpected manner:
- If possible, try to reproduce the same issue with logging set to `:debug`. You
can set this by modifying `config/environment/production.rb` (or whatever
environment you are in) and setting `config.log_level` to `:debug`. This will
give us more detailed logs. Remember to restart Portus when doing this.
And remember to set that value to `:info` back again once you're done,
otherwise your logs will grow quite rapidly!
give us more detailed logs. Another way to set this in production is by
setting the `PORTUS_LOG_LEVEL` environment variable to `debug`. Remember to
restart Portus when doing this. And remember to set that value to `:info`
back again once you're done, otherwise your logs will grow quite rapidly!

## Check for assigned people

Expand Down
1 change: 1 addition & 0 deletions app/jobs/catalog_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def perform
Registry.find_each do |registry|
begin
cat = registry.client.catalog
Rails.logger.debug "Catalog:\n #{cat}"

# Update the registry in a transaction, since we don't want to leave
# the DB in an unknown state because of an update failure.
Expand Down
9 changes: 7 additions & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@
# config.force_ssl = true

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :info
# when problems arise by default. Otherwise, the user might specify its own
# log level through the `PORTUS_LOG_LEVEL` environment variable.
config.log_level = if ENV["PORTUS_LOG_LEVEL"]
ENV["PORTUS_LOG_LEVEL"].to_sym
else
:info
end

# Prepend all log lines with the following tags.
# config.log_tags = [:subdomain, :uuid]
Expand Down
9 changes: 7 additions & 2 deletions config/environments/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@
# config.force_ssl = true

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :info
# when problems arise by default. Otherwise, the user might specify its own
# log level through the `PORTUS_LOG_LEVEL` environment variable.
config.log_level = if ENV["PORTUS_LOG_LEVEL"]
ENV["PORTUS_LOG_LEVEL"].to_sym
else
:info
end

# Prepend all log lines with the following tags.
# config.log_tags = [:subdomain, :uuid]
Expand Down

0 comments on commit db2403f

Please sign in to comment.