-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add start/lap/stop/auto-download log snapshotting feature to repo admin tool Adds a Start log Snapshot button to the repo Log4J settings page. When clicked this dynamically creates an appender and adds it to the root logger and any other loggers that additivity disabled. This allows us to siphon off log messages into a temporary file. The button changes to Stop log Snapshot and an Add log entry button is appended along with a text box and focus is moved to the text box. If Add log entry is clicked without placing any text in the text box a number is logged to a fake logger supporttools.logsnapshot.Lap. Each time this button is pressed when the text box is empty the number is increased and logged. If there is any text in the text box when this button is pressed the text will be logged and the lap number is not increased. When Stop log Snapshot is pressed the appender is removed from any loggers it was added to and it (and the underlying file) are closed. Then the contents of this file are streamed down to the user. Finally the button changes back to Start log Snapshot and the Add log entry and associated text box are removed. If the page is reloaded during a snapshot the reference back to the temporary file is lost so there is no way to stop this instance of snapshotting. Similarly if the user starts a snapshot and then forgets to stop, we don't want an indefinite amount of log duplication. As such a customer appender is used. Each time a log entry is provided it checks if it has been open for more than 20 minutes. If so it will deregister from all loggers and close the appender. If the user simply forgot to stop the snapshot and the appender is removed, when they click the Stop log Snapshot button, the first 20 minutes of log entries will be downloaded. While focus is on the log entry (lap) text box if enter is pressed it will trigger the Add log entry button, similarly if the Escape key is pressed while this text box has focus, the Stop log Snapshot button is triggered.
- Loading branch information
1 parent
70557e8
commit b76a5c4
Showing
19 changed files
with
562 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...derofthebee/support-tools/admin/ootbee-support-tools/log4j-snapshot-complete.get.desc.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
11 changes: 11 additions & 0 deletions
11
...orderofthebee/support-tools/admin/ootbee-support-tools/log4j-snapshot-create.get.desc.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
27 changes: 27 additions & 0 deletions
27
...s/org/orderofthebee/support-tools/admin/ootbee-support-tools/log4j-snapshot-create.get.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) 2017 Bindu Wavell | ||
* Copyright (C) 2017 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-2017 Alfresco Software Limited. | ||
*/ | ||
|
||
model.snapshotLogFile = createSnapshot(); |
29 changes: 29 additions & 0 deletions
29
...orderofthebee/support-tools/admin/ootbee-support-tools/log4j-snapshot-create.get.json.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<#compress> | ||
<#-- | ||
Copyright (C) 2017 Bindu Wavell | ||
Copyright (C) 2017 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-2017 Alfresco Software Limited. | ||
--> | ||
|
||
{ | ||
"snapshotLogFile": "${snapshotLogFile}" | ||
} | ||
</#compress> |
11 changes: 11 additions & 0 deletions
11
...g/orderofthebee/support-tools/admin/ootbee-support-tools/log4j-snapshot-lap.post.desc.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
<format default="json" /> | ||
<authentication>admin</authentication> | ||
<lifecycle>internal</lifecycle> | ||
<transaction>none</transaction> | ||
<family>OOTBee Support Tools</family> | ||
</webscript> |
27 changes: 27 additions & 0 deletions
27
...pts/org/orderofthebee/support-tools/admin/ootbee-support-tools/log4j-snapshot-lap.post.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) 2017 Bindu Wavell | ||
* Copyright (C) 2017 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-2017 Alfresco Software Limited. | ||
*/ | ||
|
||
logSnapshotLapMessage(args['message']); |
26 changes: 26 additions & 0 deletions
26
...g/orderofthebee/support-tools/admin/ootbee-support-tools/log4j-snapshot-lap.post.json.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<#compress> | ||
<#-- | ||
Copyright (C) 2017 Bindu Wavell | ||
Copyright (C) 2017 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-2017 Alfresco Software Limited. | ||
--> | ||
{} | ||
</#compress> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
b76a5c4
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.
It did not occur to me that when I squashed the commits from the development branch we'd lose the history of contribution that happened during the hackathon at BeeCon.
In addition to myself, Ana Gouveia and Michael Bui also worked on this effort. And of course Axel Faust provided invaluable guidance and insights.