Skip to content

Commit

Permalink
make sql and federation debug-logging configurable
Browse files Browse the repository at this point in the history
by default both are disabled now, you can enable them in the
diaspora.yml if you need them.

closes diaspora#6090
  • Loading branch information
SuperTux88 authored and jhass committed Jun 9, 2015
1 parent ea4eebd commit ce380d7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# 0.5.2.0

# Refactor
## Refactor
* Update perfect-scrollbar [#6085](https://github.com/diaspora/diaspora/pull/6085)

## Features
* Add configuration options for some debug logs [#6090](https://github.com/diaspora/diaspora/pull/6090)


# 0.5.1.0

## Refactor
Expand Down
3 changes: 3 additions & 0 deletions config/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ defaults:
logrotate:
enable: true
days: 7
debug:
sql: false
federation: false
server:
port:
listen: '0.0.0.0:3000'
Expand Down
11 changes: 11 additions & 0 deletions config/diaspora.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ configuration: ## Section
## The number of days to keep (default=7)
#days: 7

## Debug logging
debug: ## Section

## Enables the debug-logging for SQL (default=false)
## This logs every SQL-statement!
#sql: true

## Enables the federation-debug-log (default=false)
## This logs all XMLs that are used for the federation
#federation: true

## Settings affecting how ./script/server behaves.
server: ## Section
## Where the appserver should listen to (default=0.0.0.0:3000)
Expand Down
8 changes: 7 additions & 1 deletion config/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@
#
# config.log_to = %w[stdout file]
#
Logging.logger.root.level = config.log_level
Logging.logger.root.appenders = config.log_to unless config.log_to.empty?

# Default log-level (development=debug, production=info)
Logging.logger.root.level = config.log_level

# log-levels from the diaspora.yml for SQL and federation debug-logging
Logging.logger[ActiveRecord::Base].level = AppConfig.environment.logging.debug.sql? ? :debug : :info
Logging.logger["XMLLogger"].level = AppConfig.environment.logging.debug.federation? ? :debug : :info

# Under Phusion Passenger smart spawning, we need to reopen all IO streams
# after workers have forked.
#
Expand Down

0 comments on commit ce380d7

Please sign in to comment.