Browse Source

SONAR-3590 Log all Rails warnings & errors in "sonar.log" file

=> Initial issue: when an exception is raised in a ruby widget, the 
   error stack trace is not logged in the sonar.log file
tags/3.2
Fabrice Bellingard 12 years ago
parent
commit
d383475212

+ 12
- 6
sonar-application/src/main/assembly/conf/logback.xml View File

@@ -37,16 +37,22 @@
</encoder>
</appender>

<!--
Profiling of HTTP requests. Set level to DEBUG in order to log all the HTTP and SQL requests.
Example of command-line to get the HTTP requests with execution time greater than 10s :
grep 'rails Completed in [0-9]\{5,\}ms' < profiling.log
-->
<!-- Display Rails warnings and errors in the standard Sonar log -->
<logger name="rails" additivity="false">
<level value="WARN"/>
<appender-ref ref="SONAR_FILE"/>
</logger>
<!--
Profiling of HTTP and SQL requests in Rails:
<logger name="rails" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="PROFILING_FILE"/>
</logger>

Example of command-line to get the HTTP requests with execution time greater than 10s :
grep 'rails Completed in [0-9]\{5,\}ms' < profiling.log
-->

<logger name="org.hibernate.cache.ReadWriteCache">
<!-- removing "An item was expired by the cache while it was locked (increase your cache timeout)" msg -->

+ 1
- 1
sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb View File

@@ -122,7 +122,7 @@ module DashboardHelper
widget_body=render :inline => widget.java_definition.getTarget().getTemplate(), :locals => {:widget_properties => widget.properties_as_hash, :widget => widget, :dashboard_configuration => @dashboard_configuration}
rescue => error
logger.error(message('dashboard.cannot_render_widget_x', :params => [widget.java_definition.getId(), error]))
logger.error(error.backtrace.join('\n'))
error.backtrace.each { |line| logger.error(' ' + line) }
end
end


+ 1
- 1
sonar-server/src/main/webapp/WEB-INF/app/views/widget/index.html.erb View File

@@ -5,7 +5,7 @@
widget_body=render :inline => @widget_definition.getTarget().getTemplate(), :locals => {:widget_properties => @widget.properties_as_hash, :widget => @widget, :dashboard_configuration => @dashboard_configuration}
rescue => error
logger.error(message('dashboard.cannot_render_widget_x', :params => [@widget_definition.getId(), error]))
logger.error(error.backtrace.join("\n"))
error.backtrace.each { |line| logger.error(' ' + line) }
widget_body=""
end


Loading…
Cancel
Save