-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
57 log snapshot #81
57 log snapshot #81
Changes from 12 commits
b416c3b
0d25c38
56b14bb
25a6013
738d044
765a680
c03b3fb
a83efd7
294f883
864dc70
669b92f
84898d9
bf6f777
3cc38be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ Copyright (C) 2005-2016 Alfresco Software Limited. | |
<div class="column-full"> | ||
<div>${msg("log-settings.column.addLogger")}: | ||
<form id="addPackageForm" action="${url.service}" method="POST" enctype="multipart/form-data" accept-charset="utf-8"> | ||
<input name="logger" size="35" placeholder="logger-name"></input> | ||
<input type="text" name="logger" size="35" placeholder="logger-name"></input> | ||
<input type="hidden" name="showUnconfiguredLoggers" value="${(showUnconfiguredLoggers!false)?string}" /> | ||
<select name="level"> | ||
<option value="UNSET">${msg("log-settings.level.UNSET")?html}</option> | ||
|
@@ -54,10 +54,18 @@ Copyright (C) 2005-2016 Alfresco Software Limited. | |
<input type="submit" value="${msg("log-settings.column.add")}" style="margin-right:1em;" /> | ||
</form> | ||
<div class="buttons"> | ||
<@button id="tailRepoLog" label=msg("log-settings.tail") onclick=("Admin.showDialog('" + url.serviceContext + "/ootbee/admin/log4j-tail');")/> | ||
<@button id="showLogFiles" label=msg("log-settings.logFiles") onclick=("Admin.showDialog('" + url.serviceContext + "/ootbee/admin/log4j-log-files');")/> | ||
<@button id="resetLogSettings" label=msg("log-settings.resetAll") onclick=("AdminLS.resetLogLevel();")/> | ||
<@button id="toggleView" label=msg(showUnconfiguredLoggers?string('log-settings.hideUnconfigured', 'log-settings.showUnconfigured')) onclick=("window.location.href = '" + url.serviceContext + "/ootbee/admin/log4j-loggers?showUnconfiguredLoggers="+ (showUnconfiguredLoggers!false)?string('false','true') + "';")/> | ||
<div class="column-left"> | ||
<@button id="tailRepoLog" label=msg("log-settings.tail") onclick=("Admin.showDialog('" + url.serviceContext + "/ootbee/admin/log4j-tail');")/> | ||
<@button id="showLogFiles" label=msg("log-settings.logFiles") onclick=("Admin.showDialog('" + url.serviceContext + "/ootbee/admin/log4j-log-files');")/> | ||
<@button id="resetLogSettings" label=msg("log-settings.resetAll") onclick=("AdminLS.resetLogLevel();")/> | ||
<@button id="toggleView" label=msg(showUnconfiguredLoggers?string('log-settings.hideUnconfigured', 'log-settings.showUnconfigured')) onclick=("window.location.href = '" + url.serviceContext + "/ootbee/admin/log4j-loggers?showUnconfiguredLoggers="+ (showUnconfiguredLoggers!false)?string('false','true') + "';")/> | ||
</div> | ||
<div class="column-right"> | ||
<@button id="startLogSnapshot" label=msg("log-settings.startLogSnapshot") onclick=("AdminLS.startLogSnapshot();")/> | ||
<@button id="stopLogSnapshot" style="display:none" label=msg("log-settings.stopLogSnapshot") onclick=("AdminLS.stopLogSnapshot();")/> | ||
<@button id="lapLogSnapshot" style="display:none" label=msg("log-settings.lapLogSnapshot") onclick=("AdminLS.lapLogSnapshot();")/> | ||
<input id="lapMessageLogSnapshot" type="text" size="35" style="display:none" placeholder="${msg("log-settings.lapMessageLogSnapshot")}" onkeyup="return AdminLS.handleLogMessageLogSnapshotKeyUp(event);"></input> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor thing: The indent seems off There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File has a strange mix of tabs and spaces, I converted tabs to 4 spaces as that seems to make the file look right. I wonder if we should add a lint type check for mixed tabs/spaces. This may make the file look like we changed stuff we didn't 😢 |
||
</div> | ||
<#if statusMessage?? && statusMessage != ""> | ||
<div id="statusmessage" class="message ${messageStatus!""}">${.now?string("HH:mm:ss")} - ${statusMessage?html!""} <a href="#" onclick="this.parentElement.style.display='none';" title="${msg("admin-console.close")}">[X]</a></div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,10 @@ log-settings.reset=Reset | |
log-settings.hideUnconfigured=Hide unconfigured Loggers | ||
log-settings.showUnconfigured=Show unconfigured Loggers | ||
log-settings.rootLogger=(Root Logger) | ||
log-settings.startLogSnapshot=Start log Snapshot | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have not localized these strings to languages other than English. Are there any steps we should take to make sure these strings get translated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. During the hack-a-thon I asked Eva and Mikel for direct translations. For any new features outside of a context where we have ready access to foreign language speakers it is perfectly fine to just provide English by default. Afterwards we can ping e.g. @douglascr or @angelborroy for translations (or other people for other languages), though in order to simplify this I would ask for bulk translations similar to #58. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AFaust My username is wrong there. The right one is @douglascrp There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strange - I thought I used autocomplete for that... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I'm adding the english properties to the non english properties files with a comment indicating translation is required. I assume we don't have tools that go through all properties files and figure out which properties need translating. If we have such a tool then I should not have done this. If we don't have such a tool, user experience should be the same and a translator can easily see which items they need to translate. |
||
log-settings.stopLogSnapshot=Stop log Snapshot | ||
log-settings.lapLogSnapshot=Add log entry | ||
log-settings.lapMessageLogSnapshot=If not set, lap number is logged | ||
|
||
log-settings.column.add=Add | ||
log-settings.column.addLogger=Add logger | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<webscript> | ||
<shortname>Log4J Snapshot</shortname> | ||
<description>Finish log snapshot and shows it</description> | ||
<url>/ootbee/admin/log4j-snapshot-complete/{path}</url> | ||
<authentication>admin</authentication> | ||
<lifecycle>internal</lifecycle> | ||
<transaction>none</transaction> | ||
<family>OOTBee Support Tools</family> | ||
</webscript> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<webscript> | ||
<shortname>Log4J Settings - Log File - Create Snapshot</shortname> | ||
<description>Accesses a specific Log4J log file</description> | ||
<url>/ootbee/admin/log4j-snapshot-create</url> | ||
<authentication>admin</authentication> | ||
<format default="json"/> | ||
<lifecycle>internal</lifecycle> | ||
<transaction>none</transaction> | ||
<family>OOTBee Support Tools</family> | ||
</webscript> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<import resource="classpath:alfresco/templates/webscripts/org/orderofthebee/support-tools/admin/ootbee-support-tools/log4j.lib.js"> | ||
|
||
/** | ||
* Copyright (C) 2016 Axel Faust / Markus Joos / Bindu Wavell | ||
* Copyright (C) 2016 Order of the Bee | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: It is 2017 alredy so new files can already be created with the correct date. I am far from knowledgable with regards to Copyright attributions to people, but so far I have used the default policy of including only the names of people that have worked on a particular new feature (package). The default "Axel Faust / Markus Joos" was used during the Global Virtual hack-a-thon to simplify things. On new tools that I add I usually only add my name (in addition to OOTBee which should be on every file). For this PR it should probably be the names of all the hack-a-thon participants that contributed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case I worked on this file so I'll just add my name. I'll go through the other files with copyright info and make sure the appropriate folks are listed. |
||
* | ||
* This file is part of Community Support Tools | ||
* | ||
* Community Support Tools is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Community Support Tools is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Community Support Tools. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
/* | ||
* Linked to Alfresco | ||
* Copyright (C) 2005-2016 Alfresco Software Limited. | ||
*/ | ||
|
||
model.snapshotLogFile = createSnapshot(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<#compress> | ||
<#-- | ||
Copyright (C) 2016 Axel Faust / Markus Joos / Bindu Wavell | ||
Copyright (C) 2016 Order of the Bee | ||
|
||
This file is part of Community Support Tools | ||
|
||
Community Support Tools is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
Community Support Tools is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public License | ||
along with Community Support Tools. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
Linked to Alfresco | ||
Copyright (C) 2005-2016 Alfresco Software Limited. | ||
|
||
--> | ||
|
||
{ | ||
"snapshotLogFile": "${snapshotLogFile}" | ||
} | ||
</#compress> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<webscript> | ||
<shortname>Log4J Snapshot Lap</shortname> | ||
<description>Log4J Snapshot Log Lap Message</description> | ||
<url>/ootbee/admin/log4j-snapshot-lap?message={message}</url> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could allow an optional log level to be specified here, but as that doesn't seem necessary for the current use case, I left it out and figured it could be added without breaking anything later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An optional log level only makes sense if someone would re-configure the log level of the snapshot lap logger. And currently you are always resetting that to INFO anyway. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code could auto-configure the log level based on what is passed in. I don't see this as particularly useful for the UI. However, if folks start using these webscripts for sysadmin activities it might be helpful. In any case I'm not planning to do anything here 😄 |
||
<format default="json" /> | ||
<authentication>admin</authentication> | ||
<lifecycle>internal</lifecycle> | ||
<transaction>none</transaction> | ||
<family>OOTBee Support Tools</family> | ||
</webscript> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<import resource="classpath:alfresco/templates/webscripts/org/orderofthebee/support-tools/admin/ootbee-support-tools/log4j.lib.js"> | ||
|
||
/** | ||
* Copyright (C) 2016 Axel Faust / Markus Joos / Bindu Wavell | ||
* Copyright (C) 2016 Order of the Bee | ||
* | ||
* This file is part of Community Support Tools | ||
* | ||
* Community Support Tools is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Community Support Tools is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Community Support Tools. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
/* | ||
* Linked to Alfresco | ||
* Copyright (C) 2005-2016 Alfresco Software Limited. | ||
*/ | ||
|
||
logSnapshotLapMessage(args['message']); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<#compress> | ||
<#-- | ||
Copyright (C) 2016 Axel Faust / Bindu Wavell | ||
Copyright (C) 2016 Order of the Bee | ||
|
||
This file is part of Community Support Tools | ||
|
||
Community Support Tools is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
Community Support Tools is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public License | ||
along with Community Support Tools. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
Linked to Alfresco | ||
Copyright (C) 2005-2016 Alfresco Software Limited. | ||
|
||
--> | ||
{} | ||
</#compress> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -420,3 +420,53 @@ function buildLogFilesModel(useAllLoggerAppenders) | |
model.logFiles = logFiles; | ||
model.locale = Packages.org.springframework.extensions.surf.util.I18NUtil.getLocale().toString(); | ||
} | ||
|
||
function getLoggersToSnapshot() | ||
{ | ||
var logger, loggers, currentLoggers, loggerRepository; | ||
|
||
logger = Packages.org.apache.log4j.Logger.getRootLogger(); | ||
loggers = [logger]; | ||
|
||
loggerRepository = Packages.org.apache.log4j.LogManager.getLoggerRepository(); | ||
currentLoggers = loggerRepository.currentLoggers; | ||
while (currentLoggers.hasMoreElements()) | ||
{ | ||
logger = currentLoggers.nextElement(); | ||
if (!logger.additivity) | ||
{ | ||
loggers.push(logger); | ||
} | ||
} | ||
return loggers; | ||
} | ||
|
||
/* exported createSnapshot */ | ||
function createSnapshot() | ||
{ | ||
var snapshotLogFile, logLayout, snapshotAppender, loggers; | ||
|
||
snapshotLogFile = Packages.org.alfresco.util.TempFileProvider.createTempFile("ootbee-support-tools-snapshot", ".log"); | ||
logLayout = new Packages.org.apache.log4j.PatternLayout('%d{yyyy-MM-dd} %d{ABSOLUTE} %-5p [%c] [%t] %m%n'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if the log pattern should be configurable. Might not be in this iteration but for future improvement. E.g. I might want to check components that use MDC data and need to include the specific keys in the pattern. This is irrelevant for default Alfresco which unfortunately does not use MDC, but might be relevant for custom solutions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since I'm not sure how you'd want to pass this configuration in, I'm going to leave it fixed like this. Happy to work on another issue if you write up how you'd like to have that done (although I expect writing it up would take more time than doing it yourself ;) ... of course if you have another CL showing the approach you'd like to use you could just reference that...) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I created #82 to track the idea of a configurable log pattern. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks Axel! |
||
snapshotAppender = new Packages.org.orderofthebee.addons.support.tools.repo.TemporaryFileAppender(logLayout, snapshotLogFile); | ||
loggers = getLoggersToSnapshot(); | ||
loggers.forEach(function(logger) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AFaust I couldn't find anywhere where you used this annonymous function syntax so I was not certain how you would format this. I ended up using the syntax that's in the jquery table stuff we are using for support tools. Let me know if you feel strongly that this should be changed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would use the same formatting rules as with any other function, which in this case basically amounts to "braces on the next line". I would also name such functions as a rule since that would include useful information in Rhino stacktraces in case of errors, especially when scripts are merged using the import tag (which we use abundantly in this addon) and line numbers no longer align. |
||
snapshotAppender.registerAsAppender(logger); | ||
} ); | ||
|
||
return snapshotLogFile; | ||
} | ||
|
||
/* exported logSnapshotLapMessage */ | ||
function logSnapshotLapMessage(message) { | ||
var root, clazz, level, lapLogger; | ||
|
||
root = Packages.org.apache.log4j.Logger.getRootLogger(); | ||
level = Packages.org.apache.log4j.Level.INFO; | ||
// Fake logger that produces a good log message with the Alfresco default log format | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The console logger just shows the last 3 segments of the logger class "supporttools.logsnapshot.Lap" which is why I removed some periods. Since this is a fake logger I hope that is acceptable. The snapshot appender itself includes the fully qualified class name so we can make this more accurate if folks would prefer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer using our base Java package name for consistent logger names (in this case ´org.orderofthebee.addons.support.tools.repo´ so we end up with e.g. ´org.orderofthebee.addons.support.tools.repo.logSnapshotLap'). I feel we should not worry about how a specific, pre-defined appender will output the package name - it is more important that the last segment (which should always be present) is sufficiently meaningful. E.g. I may re-route Log4J via SLF4J to Logback and this will only include the initial character of each package level, e.g. `o.o.a.s.t.repo.logSnapshotLap' There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will make the suggested change to the fake logger. Since I want to make sure this logger has the right log level I need the level variable. Given that I figured I'd use the generic log() method. That way we could change the level reference and the code would continue to work. Otherwise if the level is changed to say error, if we used the info() method our log statements would not show up. I don't feel super strongly about this, but have not made a change given the above justification. If you have a strong feeling about this let me know and I'll change it. |
||
clazz = 'org.orderofthebee.addons.supporttools.logsnapshot.Lap'; | ||
lapLogger = root.getLogger(clazz); | ||
lapLogger.setLevel(level); | ||
|
||
lapLogger.log(level, message); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,13 @@ var AdminLS = AdminLS || {}; | |
|
||
(function() | ||
{ | ||
var serviceContext; | ||
var KEYCODE_ENTER = 13; | ||
var KEYCODE_ESC = 27; | ||
|
||
var serviceContext; | ||
var snapshotLogFile; | ||
var snapshotLapNumber; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor thing: not consistent with "one var per fn" style There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hate that convention... However, I agree we should be consistent. I merged serviceContext, snapshotLogFile and snapshotLapNumber into a single var. I left KEYCODE_ENTER and KEYCODE_ESC standalone given the value assignments. Let me know if you'd prefer this be done differently. |
||
|
||
AdminLS.setServiceContext = function setServiceContext(context) | ||
{ | ||
serviceContext = context; | ||
|
@@ -51,5 +56,68 @@ var AdminLS = AdminLS || {}; | |
} | ||
}); | ||
}; | ||
|
||
AdminLS.startLogSnapshot = function startLogSnapshot() | ||
{ | ||
Admin.request({ | ||
url : serviceContext + '/ootbee/admin/log4j-snapshot-create', | ||
method : 'GET', | ||
fnSuccess : function startLogSnapshot_success(res) | ||
{ | ||
if (res.responseText) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reviewing this file, this condition should probably be if (res.responseJSON). |
||
{ | ||
snapshotLogFile = res.responseJSON.snapshotLogFile; | ||
document.getElementById("startLogSnapshot").style.display = 'none'; | ||
document.getElementById("stopLogSnapshot").style.display = 'inline'; | ||
document.getElementById("lapLogSnapshot").style.display = 'inline'; | ||
document.getElementById("lapMessageLogSnapshot").style.display = 'inline'; | ||
document.getElementById("lapMessageLogSnapshot").focus(); | ||
snapshotLapNumber = 1; | ||
} | ||
} | ||
}); | ||
}; | ||
|
||
AdminLS.stopLogSnapshot = function stopLogSnapshot() | ||
{ | ||
window.open(serviceContext + '/ootbee/admin/log4j-snapshot-complete/'+snapshotLogFile+'?a=true','_blank'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder - is an explicit window.open really necessary (compared to a simple navigate/href update)? I understand there could be issues due to the text/plain mimetype which a browser might display inline instead, but shouldn't the a=true already handle that via a proper content-disposition in the response? I know we discussed this during the hack-a-thon and I think Ana mentioned that there were some limitations with some browser(s). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know the answer to this question. Given that I tested this and it works. Do object to leaving it as is? |
||
document.getElementById("startLogSnapshot").style.display = 'inline'; | ||
document.getElementById("stopLogSnapshot").style.display = 'none'; | ||
document.getElementById("lapLogSnapshot").style.display = 'none'; | ||
document.getElementById("lapMessageLogSnapshot").style.display = 'none'; | ||
}; | ||
|
||
AdminLS.lapLogSnapshot = function lapLogSnapshot() | ||
{ | ||
var inputEl = document.getElementById("lapMessageLogSnapshot"); | ||
var message = inputEl.value; | ||
if (!message) | ||
{ | ||
message = snapshotLapNumber++; | ||
} | ||
Admin.request({ | ||
url : serviceContext + '/ootbee/admin/log4j-snapshot-lap?message=' + message, | ||
method : 'POST', | ||
fnSuccess : function lapLogSnapshot_success() | ||
{ | ||
inputEl.value = ''; | ||
inputEl.focus(); | ||
} | ||
}); | ||
}; | ||
|
||
AdminLS.handleLogMessageLogSnapshotKeyUp = function handleLogMessageLogSnapshotKeyUp(event) | ||
{ | ||
if (event.keyCode === KEYCODE_ENTER) { | ||
event.preventDefault(); | ||
document.getElementById("lapLogSnapshot").click(); | ||
return false; | ||
} | ||
if (event.keyCode === KEYCODE_ESC) { | ||
event.preventDefault(); | ||
document.getElementById("stopLogSnapshot").click(); | ||
return false; | ||
} | ||
return true; | ||
}; | ||
}()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some CSS so that inputs that explicitly have type="text" will be slightly taller than default (to match surrounding buttons) and will have a little left and right padding.