Skip to content

Commit

Permalink
feature: configurable log level for log/sphinx.log
Browse files Browse the repository at this point in the history
  • Loading branch information
bibendi committed Sep 22, 2015
1 parent 98c14c7 commit 07d726c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ production:
pid_file: pid/searchd.pid
searchd_file_path: data
binlog_path: binlog
log_level: warn
```
### production with replication
Expand Down Expand Up @@ -111,6 +112,7 @@ production:
rt_flush_period: 86400
agent_connect_timeout: 50
ha_strategy: nodeads
log_level: warn

user: sphinx
remote_path: /home/index/master
Expand Down
2 changes: 1 addition & 1 deletion lib/sphinx/integration/extensions/thinking_sphinx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def log(message, severity = ::Logger::INFO)
def logger
@logger ||= ::Logger.new(Rails.root.join("log", "sphinx.log")).tap do |logger|
logger.formatter = ::Logger::Formatter.new
logger.level = ::Rails.logger.try(:level) || ::Logger::INFO
logger.level = ::Logger.const_get(::ThinkingSphinx::Configuration.instance.log_level.upcase)
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Sphinx::Integration::Extensions::ThinkingSphinx::Configuration

included do
attr_accessor :remote, :replication, :agent_connect_timeout, :agent_query_timeout,
:ha_strategy, :user, :password, :exclude
:ha_strategy, :user, :password, :exclude, :log_level, :mysql_read_timeout, :mysql_connect_timeout

attr_reader :agents

Expand Down Expand Up @@ -39,6 +39,9 @@ def reset_with_integration(custom_app_root = nil)
self.ha_strategy = 'nodeads'
self.user = 'sphinx'
self.exclude = []
self.log_level = "warn"
self.mysql_connect_timeout = 2
self.mysql_read_timeout = 5
@configuration.searchd.listen_all_interfaces = true

reset_without_integration(custom_app_root)
Expand Down

0 comments on commit 07d726c

Please sign in to comment.