diff --git a/lib/pact_broker/ui.rb b/lib/pact_broker/ui.rb index 28e47acea..02af4c21e 100644 --- a/lib/pact_broker/ui.rb +++ b/lib/pact_broker/ui.rb @@ -1,14 +1,14 @@ - +require 'pact_broker/configuration' # Stop Padrino creating a log file, as it will try to create it in the gems directory # http://www.padrinorb.com/api/Padrino/Logger.html unless defined? PADRINO_LOGGER + log_path = File.join(PactBroker.configuration.log_dir, 'ui.log') PADRINO_LOGGER = { - production: { log_level: :error, stream: :stderr }, - staging: { log_level: :error, stream: :stderr }, - test: { log_level: :warn, stream: :stdout }, - development: { log_level: :warn, stream: :stdout } + production: { log_level: :error, stream: :to_file, log_path: log_path }, + staging: { log_level: :error, stream: :to_file, log_path: log_path }, + test: { log_level: :warn, stream: :to_file, log_path: log_path }, + development: { log_level: :warn, stream: :to_file, log_path: log_path } } end require 'pact_broker/ui/app' - diff --git a/lib/pact_broker/ui/controllers/error_test.rb b/lib/pact_broker/ui/controllers/error_test.rb index a330175e8..2668d0b44 100644 --- a/lib/pact_broker/ui/controllers/error_test.rb +++ b/lib/pact_broker/ui/controllers/error_test.rb @@ -7,7 +7,6 @@ module UI module Controllers class ErrorTest < Base include PactBroker::Services - include PactBroker::Logging get "/" do raise PactBroker::Error.new("Don't panic. This is a test UI error.") diff --git a/lib/pact_broker/ui/controllers/matrix.rb b/lib/pact_broker/ui/controllers/matrix.rb index 1448ba7f0..c9b0de588 100644 --- a/lib/pact_broker/ui/controllers/matrix.rb +++ b/lib/pact_broker/ui/controllers/matrix.rb @@ -10,7 +10,6 @@ module Controllers class Matrix < Base include PactBroker::Services - include PactBroker::Logging get "/" do selectors = [OpenStruct.new, OpenStruct.new] @@ -35,7 +34,7 @@ class Matrix < Base end end rescue StandardError => e - log_error(e) unless e.is_a?(PactBroker::Error) + Padrino.logger.exception(e) unless e.is_a?(PactBroker::Error) locals[:errors] = [e.message] end haml :'matrix/show', {locals: locals, layout: :'layouts/main'}