diff --git a/config/initializers/06-mini_profiler.rb b/config/initializers/06-mini_profiler.rb
index 5f7e017cb5c..2b0eedb68b9 100644
--- a/config/initializers/06-mini_profiler.rb
+++ b/config/initializers/06-mini_profiler.rb
@@ -93,3 +93,13 @@ if defined?(Rack::MiniProfiler)
 
   # Rack::MiniProfiler.profile_method ActionView::PathResolver, 'find_templates'
 end
+
+
+if ENV["PRINT_EXCEPTIONS"]
+  trace      = TracePoint.new(:raise) do |tp|
+    puts tp.raised_exception
+    puts tp.raised_exception.backtrace.join("\n")
+    puts
+  end
+  trace.enable
+end