Apache Lucene open-source search software
SOLR-5189: Solr 4.x Web UI Log Viewer does not display 'date' column from logs
Stefan Matheis765f907be112
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 142b1c06448..50ecba43086 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -162,6 +162,9 @@ Optimizations* SOLR-5436: Eliminate the 1500ms wait in overseer loop as well aspolling the ZK distributed queue. (Noble Paul, Mark Miller)+* SOLR-5189: Solr 4.x Web UI Log Viewer does not display 'date' column from+ logs (steffkes)+Other Changes---------------------diff --git a/solr/webapp/web/css/styles/logging.css b/solr/webapp/web/css/styles/logging.cssindex 86a835f51fd..6d309575de7 100644--- a/solr/webapp/web/css/styles/logging.css+++ b/solr/webapp/web/css/styles/logging.css@@ -41,12 +41,48 @@ limitations under the License.position: relative;}+#content #logging #viewer time+{+ white-space: pre;+}++#content #logging #viewer #footer+{+ margin-top: 20px;+}+#content #logging #viewer #state{background-position: 0 50%;+ float: left;color: #c0c0c0;- margin-top: 20px;padding-left: 21px;+ width: 45%;+}++#content #logging #viewer #date-format+{+ float: right;+}++#content #logging #viewer #date-format a+{+ background-image: url( ../../img/ico/ui-check-box-uncheck.png );+ background-position: 0 50%;+ color: #c0c0c0;+ display: block;+ padding-left: 21px;+}++#content #logging #viewer #date-format a:hover+{+ color: #008;+}++#content #logging #viewer #date-format a.on+{+ background-image: url( ../../img/ico/ui-check-box.png );+ color: #333;}#content #logging #viewer tablediff --git a/solr/webapp/web/js/scripts/logging.js b/solr/webapp/web/js/scripts/logging.jsindex 05f61b3f318..84faeacfd97 100644--- a/solr/webapp/web/js/scripts/logging.js+++ b/solr/webapp/web/js/scripts/logging.js@@ -16,6 +16,7 @@*/var loglevel_path = app.config.solr_path + '/admin/info/logging';+var cookie_logging_timezone = 'logging_timezone';var frame_element = null;var logging_handler = function( response, text_status, xhr )@@ -253,10 +254,17 @@ var logging_handler = function( response, text_status, xhr )};+var format_time_options = {};+var format_time = function( time ){time = time ? new Date( time ) : new Date();- return '<abbr title="' + time.toLocaleString().esc() + '">' + time.toTimeString().split( ' ' ).shift().esc() + '</abbr>';+ return '<time datetime="' + time.toISOString().esc() + '">' + format_time_content( time ) + '</abbr>';+}++var format_time_content = function( time )+{+ return time.toLocaleString( undefined, format_time_options ).esc();}var load_logging_viewer = function()@@ -423,7 +431,7 @@ sammy.get'<table border="0" cellpadding="0" cellspacing="0">' + "\n" +'<thead>' + "\n" +'<tr>' + "\n" +- '<th class="time">Time</th>' + "\n" ++ '<th class="time">Time (<span>Local</span>)</th>' + "\n" +'<th class="level">Level</th>' + "\n" +'<th class="logger">Logger</th>' + "\n" +'<th class="message">Message</th>' + "\n" +@@ -435,7 +443,10 @@ sammy.get'</tr>' + "\n" +'</thead>' + "\n" +'</table>' + "\n" +- '<div id="state" class="loader"> </div>' + "\n" ++ '<div id="footer" class="clearfix">' + "\n" ++ '<div id="state" class="loader"> </div>' + "\n" ++ '<div id="date-format"><a>Show dates in UTC</a></div>' + "\n" ++ '</div>' + "\n" +'</div>');@@ -475,6 +486,52 @@ sammy.getreturn false;});++ var date_format = $( '#date-format a', frame_element );++ date_format+ .off( 'click' )+ .on+ (+ 'click',+ function( event )+ {+ var self = $( this );++ if( !self.hasClass( 'on' ) )+ {+ self.addClass( 'on' );+ $( 'table th.time span', frame_element ).text( 'UTC' );+ format_time_options.timeZone = 'UTC';+ $.cookie( cookie_logging_timezone, 'UTC' );+ }+ else+ {+ self.removeClass( 'on' );+ $( 'table th.time span', frame_element ).text( 'Local' );+ delete format_time_options.timeZone;+ $.cookie( cookie_logging_timezone, null );+ }++ $( 'time', frame_element )+ .each+ (+ function( index, element )+ {+ var self = $( element );+ self.text( format_time_content( new Date( self.attr( 'datetime' ) ) ) );+ }+ )++ return false;+ }+ );++ if( 'UTC' === $.cookie( cookie_logging_timezone ) )+ {+ date_format+ .trigger( 'click' );+ }});}