Logster update
cleans up a bunch of messed up context stuff with multisite improves backtraces adds request params
This commit is contained in:
parent
4de0351aea
commit
7fbf162666
|
@ -152,7 +152,7 @@ GEM
|
||||||
thor (~> 0.15)
|
thor (~> 0.15)
|
||||||
libv8 (3.16.14.3)
|
libv8 (3.16.14.3)
|
||||||
listen (0.7.3)
|
listen (0.7.3)
|
||||||
logster (0.0.9)
|
logster (0.0.10)
|
||||||
lru_redux (0.8.1)
|
lru_redux (0.8.1)
|
||||||
mail (2.5.4)
|
mail (2.5.4)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class ForumsController < ApplicationController
|
class ForumsController < ApplicationController
|
||||||
|
|
||||||
skip_before_filter :check_xhr, only: [:status]
|
skip_before_filter :check_xhr
|
||||||
skip_before_filter :authorize_mini_profiler, only: [:status]
|
skip_before_filter :authorize_mini_profiler, only: [:status]
|
||||||
skip_before_filter :redirect_to_login_if_required, only: [:status]
|
skip_before_filter :redirect_to_login_if_required, only: [:status]
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,9 @@
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<% if Rails.env.development? %>
|
<script>
|
||||||
<script>
|
Ember.RSVP.configure('onerror', function(e) {
|
||||||
// Don't swallow promises in development mode. Let's fix those.
|
<% if Rails.env.development? %>
|
||||||
Ember.RSVP.configure('onerror', function(e) {
|
|
||||||
if (e) {
|
if (e) {
|
||||||
if (e.message || e.stack) {
|
if (e.message || e.stack) {
|
||||||
console.log(e.message);
|
console.log(e.message);
|
||||||
|
@ -25,9 +24,10 @@
|
||||||
} else {
|
} else {
|
||||||
console.log("A promise failed but was not caught.");
|
console.log("A promise failed but was not caught.");
|
||||||
}
|
}
|
||||||
});
|
<% end %>
|
||||||
</script>
|
window.onerror(e && e.message, null,null,null,e);
|
||||||
<% end %>
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
Discourse.CDN = '<%= Rails.configuration.action_controller.asset_host %>';
|
Discourse.CDN = '<%= Rails.configuration.action_controller.asset_host %>';
|
||||||
|
|
|
@ -1,6 +1,27 @@
|
||||||
if Rails.env.production?
|
if Rails.env.production?
|
||||||
# honestly, Rails should not be logging this, its real noisy
|
# honestly, Rails should not be logging this, its real noisy
|
||||||
Logster.store.ignore = [
|
Logster.store.ignore = [
|
||||||
/^ActionController::RoutingError \(No route matches/
|
/^ActionController::RoutingError \(No route matches/
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Logster.config.authorize_callback = lambda{|env|
|
||||||
|
user = CurrentUser.lookup_from_env(env)
|
||||||
|
user && user.admin
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# middleware that logs errors sits before multisite
|
||||||
|
# we need to establish a connection so redis connection is good
|
||||||
|
# and db connection is good
|
||||||
|
Logster.config.current_context = lambda{|env,&blk|
|
||||||
|
begin
|
||||||
|
if Rails.configuration.multisite
|
||||||
|
request = Rack::Request.new(env)
|
||||||
|
ActiveRecord::Base.connection_handler.clear_active_connections!
|
||||||
|
RailsMultisite::ConnectionManagement.establish_connection(:host => request['__ws'] || request.host)
|
||||||
|
end
|
||||||
|
blk.call
|
||||||
|
ensure
|
||||||
|
ActiveRecord::Base.connection_handler.clear_active_connections!
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
|
@ -14,11 +14,12 @@ Discourse::Application.routes.draw do
|
||||||
match "/404", to: "exceptions#not_found", via: [:get, :post]
|
match "/404", to: "exceptions#not_found", via: [:get, :post]
|
||||||
get "/404-body" => "exceptions#not_found_body"
|
get "/404-body" => "exceptions#not_found_body"
|
||||||
|
|
||||||
mount Sidekiq::Web => "/sidekiq", constraints: AdminConstraint.new
|
if Rails.env == "development"
|
||||||
|
mount Sidekiq::Web => "/sidekiq"
|
||||||
if Rails.env.production?
|
mount Logster::Web => "/logs"
|
||||||
require 'logster/middleware/viewer'
|
else
|
||||||
mount Logster::Middleware::Viewer.new(nil) => "/logs", constraints: AdminConstraint.new
|
mount Sidekiq::Web => "/sidekiq", constraints: AdminConstraint.new
|
||||||
|
mount Logster::Web => "/logs", constraints: AdminConstraint.new
|
||||||
end
|
end
|
||||||
|
|
||||||
get "site" => "site#index"
|
get "site" => "site#index"
|
||||||
|
|
|
@ -5,7 +5,9 @@ module RailsMultisite
|
||||||
end
|
end
|
||||||
|
|
||||||
initializer "RailsMultisite.init" do |app|
|
initializer "RailsMultisite.init" do |app|
|
||||||
|
Rails.configuration.multisite = false
|
||||||
if File.exists?(ConnectionManagement.config_filename)
|
if File.exists?(ConnectionManagement.config_filename)
|
||||||
|
Rails.configuration.multisite = true
|
||||||
ConnectionManagement.load_settings!
|
ConnectionManagement.load_settings!
|
||||||
app.middleware.insert_after(ActiveRecord::ConnectionAdapters::ConnectionManagement, RailsMultisite::ConnectionManagement)
|
app.middleware.insert_after(ActiveRecord::ConnectionAdapters::ConnectionManagement, RailsMultisite::ConnectionManagement)
|
||||||
app.middleware.delete(ActiveRecord::ConnectionAdapters::ConnectionManagement)
|
app.middleware.delete(ActiveRecord::ConnectionAdapters::ConnectionManagement)
|
||||||
|
|
Loading…
Reference in New Issue