diff --git a/Gemfile.lock b/Gemfile.lock index 7d19c8d9ffa..dc564b17a72 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -167,7 +167,7 @@ GEM logstash-event (1.2.02) logstash-logger (0.26.1) logstash-event (~> 1.2) - logster (2.3.0) + logster (2.3.2) loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) diff --git a/app/assets/javascripts/preload-application-data.js.no-module.es6 b/app/assets/javascripts/preload-application-data.js.no-module.es6 index fd22628ae09..f78ea11367f 100644 --- a/app/assets/javascripts/preload-application-data.js.no-module.es6 +++ b/app/assets/javascripts/preload-application-data.js.no-module.es6 @@ -12,6 +12,9 @@ var setupData = document.getElementById("data-discourse-setup").dataset; + window.Logster = window.Logster || {}; + window.Logster.enabled = setupData.enableJsErrorReporting === "true"; + Discourse.CDN = setupData.cdn; Discourse.BaseUrl = setupData.baseUrl; Discourse.BaseUri = setupData.baseUri; diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index dfb1d5e88a8..8e2e44781c8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -469,6 +469,7 @@ module ApplicationHelper disable_custom_css: loading_admin?, highlight_js_path: HighlightJs.path, svg_sprite_path: SvgSprite.path(theme_ids), + enable_js_error_reporting: GlobalSetting.enable_js_error_reporting, } if Rails.env.development? diff --git a/config/discourse_defaults.conf b/config/discourse_defaults.conf index e66ed464b20..6a5db787407 100644 --- a/config/discourse_defaults.conf +++ b/config/discourse_defaults.conf @@ -249,3 +249,6 @@ maxmind_backup_path = # X-Queue-Time: 1.01 enable_performance_http_headers = false +# gather JavaScript errors from clients (rate limited to 1 error per IP per minute) +enable_js_error_reporting = true + diff --git a/config/initializers/100-logster.rb b/config/initializers/100-logster.rb index 06e6ba66b9c..99873698087 100644 --- a/config/initializers/100-logster.rb +++ b/config/initializers/100-logster.rb @@ -104,6 +104,7 @@ Logster.config.subdirectory = "#{GlobalSetting.relative_url_root}/logs" Logster.config.application_version = Discourse.git_version Logster.config.enable_custom_patterns_via_ui = true +Logster.config.enable_js_error_reporting = GlobalSetting.enable_js_error_reporting store = Logster.store redis = Logster.store.redis