Jump to content
DarrenWhite99

Combine Script Log Entries for easy review or inclusion in a ticket

Recommended Posts

The horribleness that is the new Agent UI Script tile has made Script Log reading a painful experience, but it started a conversation about combining SCRIPT LOG entries when possible. One method would be to defer logging, using a variable to accumulate information and then logging it all at once. Another would be to call your own SQL to append information into an existing entry. I believe this script is superior to both methods. :D

With this script you would use the SCRIPT LOG step as normal. Each time it is used, a new entry will be recorded as normal, no special treatment of logging is needed. At the end of your script you just call this function script;. This script will combine all the script log lines recorded on this computer under the current script id, since the start of this script into 1 entry and delete the other entries. The combined result will also be returned in a variable named "@SCRIPTLOGS@" in case you wanted to email them, attach them to a ticket, etc.

Download Here:   FUNCTION - Consolidate Script Log Entries.zip

Here is an example before the script is called, with the individual SCRIPT LOG entries.ScriptLog-IndividualEntries.jpg.659aeec0d1b94c0afc9c937ae227c1c8.jpg

Here is the Script Log entry after running.

ScriptLog-CombinedEntry.jpg.2e1e380fb9e20c74d88e3701131ca882.jpg

Thank you @johnduprey for the work you did on this idea, which inspired me to create and share this!
combine merge join bundle multiple script log logs logging message messages entries scriptlog scriptlogs entry

  • Thanks 5

Share this post


Link to post
Share on other sites
Posted (edited)

Can we collect the data in a variable, keep appending things to it, and log it at the end?

 

(Somewhat answered my own ? by collecting a bunch of variables and logging it later, didn't answer append capability).

Edited by Uncle Dave

Share this post


Link to post
Share on other sites
On 4/21/2019 at 3:47 AM, Uncle Dave said:

Can we collect the data in a variable, keep appending things to it, and log it at the end?

Yes, Use Variable Set:Constant

Parameter: @RunningInfo@This is a new line. (It ends with crlf)

Variable: RunningInfo

 

You can self reference a variable as you update it, so it’s contents plus the new information will be assigned. (Just set it to nothing when you start and then you can always add to it )

The problems with this approach are:

* There is no progress as the script runs.

* If the script fails, all gathered data is lost.

* A second script called from the first can overwrite the variable contents. 

 

Thats why I created this solution. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×