Fixed FELIX-3315 Log plugin does not show the bundle that has logged the event
https://issues.apache.org/jira/browse/FELIX-3315
Fixed FELIX-3316 Log plugin should provide more detailed exception column
https://issues.apache.org/jira/browse/FELIX-3316
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1235728 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties b/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
index 8928d08..4d4f592 100644
--- a/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
+++ b/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
@@ -93,6 +93,10 @@
log.level.warn=WARN
log.level.info=INFO
log.level.debug=DEBUG
+log.traces=Exception details:
+log.traces.full=Full Trace
+log.traces.min=Message Only
+
# Bundles plugin
bundles.pluginTitle=Bundles
diff --git a/webconsole/src/main/resources/res/ui/logs.css b/webconsole/src/main/resources/res/ui/logs.css
index 16f46df..21f6d95 100644
--- a/webconsole/src/main/resources/res/ui/logs.css
+++ b/webconsole/src/main/resources/res/ui/logs.css
@@ -22,3 +22,8 @@
th.col_Level { width: 6em }
th.col_Received,
th.col_Exception { min-width: 10em }
+td.ex {
+ font-size: smaller;
+ font-family: monospace;
+ white-space: pre
+}
diff --git a/webconsole/src/main/resources/res/ui/logs.js b/webconsole/src/main/resources/res/ui/logs.js
index acfdcec..00f2221 100644
--- a/webconsole/src/main/resources/res/ui/logs.js
+++ b/webconsole/src/main/resources/res/ui/logs.js
@@ -47,6 +47,7 @@
var message = dataEntry.message;
var level = dataEntry.level;
var exception = dataEntry.exception;
+ var exceptionClass = $(".enableTraces").val() == 'true' ? 'ex' : null;
var service = dataEntry.service;
switch (dataEntry.raw_level) { // i18n
case 1: level = i18n.error; break;
@@ -54,11 +55,16 @@
case 3: level = i18n.info; break;
case 4: level = i18n.debug; break;
}
+ var bundle = text('');
+ if (dataEntry.bundleId) {
+ bundle = createElement( 'a', null, {href : appRoot + '/bundles/' + dataEntry.bundleId}, [ text (dataEntry.bundleName) ] )
+ }
parent.appendChild( td( null, null, [ text( printDate(dataEntry.received) ) ] ) );
parent.appendChild( td( null, { lvl:dataEntry.raw_level }, [ text( level ) ] ) );
parent.appendChild( td( null, null, [ text( wordWrap(message) ) ] ) );
parent.appendChild( td( null, null, [ text( wordWrap(service) ) ] ) );
- parent.appendChild( td( null, null, [ text( exception ) ] ) );
+ parent.appendChild( td( null, null, [ bundle ] ) );
+ parent.appendChild( td( exceptionClass, null, [ text( exception ) ] ) );
}
/* displays a date in the user's local timezone */
@@ -68,28 +74,34 @@
}
function loadData() {
- $.get(pluginRoot + "/data.json", { "minLevel":$(".minLevel").val()}, renderData, "json");
+ $.post(pluginRoot, {
+ "minLevel" : $(".minLevel").val(),
+ "traces" : $(".enableTraces").val()
+ }, renderData, "json");
return false; // for button
}
$(document).ready(function() {
// install user interaction handlers
$(".reloadButton").click(loadData);
+ $(".enableTraces").change(function() {
+ var val = $(this).val();
+ $(".enableTraces").val(val); // same values for both select boxes
+ loadData();
+ })
$(".minLevel").change(function() {
var value = $(this).val();
$(".minLevel").val(value); // same values for both select boxes
- $.post(pluginRoot, {"minLevel":value}, function(data) {
- renderData(data);
- }, "json");
+ loadData();
});
- // init tablesorte
+ // init tablesorte
$('#plugin_table').tablesorter({
textExtraction: function(node) {
var _ = $(node);
return _.attr('lvl') ? _.attr('lvl') : _.text();
}
});
-
+
logsElem = $("#logs");
logs2Elem = $("#logs2");
tableElem = $("#plugin_table");
diff --git a/webconsole/src/main/resources/templates/logs.html b/webconsole/src/main/resources/templates/logs.html
index 2086dcb..48a852f 100644
--- a/webconsole/src/main/resources/templates/logs.html
+++ b/webconsole/src/main/resources/templates/logs.html
@@ -20,6 +20,11 @@
<!-- buttons top -->
<form method="post" enctype="multipart/form-data" action="">
<div class="ui-widget-header ui-corner-top buttonGroup">
+ <label>${log.traces}</label>
+ <select class="enableTraces">
+ <option value="false">${log.traces.min}</option>
+ <option value="true">${log.traces.full}</option>
+ </select>
<label>${log.severity.label}</label>
<select class="minLevel">
<option value="1">${log.level.error}</option>
@@ -39,17 +44,23 @@
<th class="col_Level">${log.level}</th>
<th class="col_Message">${log.message}</th>
<th class="col_Service">${log.service}</th>
+ <th class="col_Bundle">${bundle}</th>
<th class="col_Exception">${log.exception}</th>
</tr>
</thead>
<tbody>
- <tr><td colspan="5"> </td></tr>
+ <tr><td colspan="6"> </td></tr>
</tbody>
</table>
<!-- buttons bottom -->
<form method="post" enctype="multipart/form-data" action="">
<div class="ui-widget-header ui-corner-bottom buttonGroup">
+ <label>${log.traces}</label>
+ <select class="enableTraces">
+ <option value="false">${log.traces.min}</option>
+ <option value="true">${log.traces.full}</option>
+ </select>
<label>${log.severity.label}</label>
<select class="minLevel">
<option value="1">${log.level.error}</option>