aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/js/apps/system/app.js82
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/system/_monitor.html.erb19
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties9
3 files changed, 58 insertions, 52 deletions
diff --git a/server/sonar-web/src/main/js/apps/system/app.js b/server/sonar-web/src/main/js/apps/system/app.js
index 3b535550657..6f01aa94453 100644
--- a/server/sonar-web/src/main/js/apps/system/app.js
+++ b/server/sonar-web/src/main/js/apps/system/app.js
@@ -3,39 +3,53 @@ import {setLogLevel} from '../../api/system';
const LOG_LEVELS = ['INFO', 'DEBUG', 'TRACE'];
-let cell = document.querySelector('#sonarqube-logs-level td:last-child');
-if (cell) {
- let currentValue = cell.textContent.trim();
+window.requestMessages().done(() => {
+ let cell = $('#sonarqube-logs-level').find('td:last-child');
+ if (cell.length) {
+ let currentValue = cell.text().trim();
+ cell.empty();
- while (cell.hasChildNodes()) {
- cell.removeChild(cell.lastChild);
- }
+ let select = $('<select>');
+ cell.append(select);
+
+ LOG_LEVELS.forEach(logLevel => {
+ let option = $('<option>');
+ option.prop('value', logLevel);
+ option.text(logLevel);
+ option.prop('selected', logLevel === currentValue);
+ select.append(option);
+ });
+
+ let format = (state) => {
+ let className = state.id !== 'INFO' ? 'text-danger' : '';
+ return `<span class="${className}">${state.id}</span>`;
+ };
+
+ let warning = $('<div>')
+ .addClass('spacer-top text-danger')
+ .text(window.t('system.log_level.warning'));
- let select = document.createElement('select');
- cell.appendChild(select);
-
- LOG_LEVELS.forEach(logLevel => {
- let option = document.createElement('option');
- option.value = logLevel;
- option.text = logLevel;
- option.selected = logLevel === currentValue;
- select.appendChild(option);
- });
-
- let format = (state) => {
- let className = state.id !== 'INFO' ? 'text-danger' : '';
- return `<span class="${className}">${state.id}</span>`;
- };
-
- $(select)
- .select2({
- width: '120px',
- minimumResultsForSearch: 999,
- formatResult: format,
- formatSelection: format
- })
- .on('change', () => {
- let newValue = select.value;
- setLogLevel(newValue);
- });
-}
+ function placeWarning () {
+ if (select.val() === 'INFO') {
+ warning.detach();
+ } else {
+ warning.insertAfter(select);
+ }
+ }
+
+ placeWarning();
+
+ $(select)
+ .select2({
+ width: '120px',
+ minimumResultsForSearch: 999,
+ formatResult: format,
+ formatSelection: format
+ })
+ .on('change', () => {
+ let newValue = select.val();
+ setLogLevel(newValue);
+ placeWarning();
+ });
+ }
+});
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/system/_monitor.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/system/_monitor.html.erb
index e85aa9cd627..d0aaca67df5 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/system/_monitor.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/system/_monitor.html.erb
@@ -25,24 +25,7 @@
<% else %>
<tr class="<%= cycle('even','odd', :name => monitor.name()) -%>" id="<%= "#{monitor.name()}-#{attribute_key}".parameterize -%>">
<td width="25%" nowrap="nowrap"><%= h attribute_key -%></td>
- <td width="75%">
- <% if attribute_key == 'Logs Level' %>
- <%
- message = ''
- css_level = ''
- if attribute_value=='TRACE'
- css_level = 'alert_ERROR'
- message = 'TRACE level has performance impacts, please make sure to get back to INFO level once your investigation is done.'
- elsif attribute_value=='DEBUG'
- css_level = 'alert_WARN'
- message = 'DEBUG level may have performance impacts, please make sure to get back to INFO level once your investigation is done.'
- end
- %>
- <span class="<%= css_level -%>"><%= h attribute_value -%></span>
- <% else %>
- <%= h attribute_value -%>
- <% end %>
- </td>
+ <td width="75%"><%= h attribute_value -%></td>
</tr>
<% end %>
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index e739976c016..241cfb7725b 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -3079,3 +3079,12 @@ background_tasks.cancel_all_tasks=Cancel All Pending Tasks
background_tasks.pending=pending
background_tasks.failures=failures
background_tasks.in_progress_duration=Duration of the current task in progress.
+
+
+
+#------------------------------------------------------------------------------
+#
+# SYSTEM
+#
+#------------------------------------------------------------------------------
+system.log_level.warning=Current level has performance impacts, please make sure to get back to INFO level once your investigation is done. Please note that when you restart the server, the level will automatically be reset to INFO.