We have a lot of verbose logging happening in our workflows. Most of it is System.log/error/debug/whatever.
Is it possible to scrape this log data out of the workflow and email it to someone?
I'm testing... I've set up a script object just to generate some content in the log. The generated log looks like this:
[2015-02-19 16:18:03.325] [I] Inputs:
[2015-02-19 16:18:03.325] [I] A is a
[2015-02-19 16:18:03.325] [I] B is b
[2015-02-19 16:18:03.325] [I] C is c
[2015-02-19 16:18:03.325] [I] E is e
[2015-02-19 16:18:03.325] [I] F is f
[2015-02-19 16:18:03.326] [I]
[2015-02-19 16:18:03.326] [I] All of them together is abcef
[2015-02-19 16:18:03.326] [I]
[2015-02-19 16:18:03.326] [I] Putting them all in to an output variable...
[2015-02-19 16:18:03.326] [I]
[2015-02-19 16:18:03.326] [I] output G is abcef
[2015-02-19 16:18:03.326] [I]
[2015-02-19 16:18:03.326] [E] Logging an error to see what it looks like
[2015-02-19 16:18:03.326] [I]
[2015-02-19 16:18:03.326] [D] Logging a debug to see what it looks like
[2015-02-19 16:18:03.326] [I]
I want to get all of this 'plain english' output as a string / array of strings so I can put it in the body of an email and send it to myself. I thought I was on to something with this code snippit:
// get error log in to array
var rootWorkflow = workflow.rootWorkflow;
// output workflow object
System.log("Outputting Debug:")
System.debug(rootWorkflow);
System.log("")
// output workflow log to array
System.log("Outputting Log Array Events:")
outputLogToArray = rootWorkflow.logEvents
// display array for temp debug
for (i in outputLogToArray) {
System.log(Server.toStringRepresentation(i))
}
But when displaying the array this is outputting something I really didn't expect, and don't really understand what it is:
[2015-02-19 16:18:03.345] [I] Outputting Debug:
[2015-02-19 16:18:03.345] [D] Workflow:ch.dunes.scripting.jsmodel.JSWorkflow@47024668
[2015-02-19 16:18:03.345] [I]
[2015-02-19 16:18:03.346] [I] Outputting Log Array Events:
[2015-02-19 16:18:03.363] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@2ab31112
[2015-02-19 16:18:03.363] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@5225caa4
[2015-02-19 16:18:03.363] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@2f1aff1e
[2015-02-19 16:18:03.364] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@156322bb
[2015-02-19 16:18:03.364] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@1f7d2df5
[2015-02-19 16:18:03.364] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@53543ff9
[2015-02-19 16:18:03.364] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@40341f2c
[2015-02-19 16:18:03.364] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@1deaa2a2
[2015-02-19 16:18:03.365] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@175b4906
[2015-02-19 16:18:03.365] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@6a1734e4
[2015-02-19 16:18:03.365] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@19919b26
[2015-02-19 16:18:03.365] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@2660e8e7
[2015-02-19 16:18:03.366] [I] StringRepresentation:ch.dunes.scripting.jsmodel.JSStringRepresentation@245aa960
and this list goes on... and on.... and on..... with just the last 8 characters changing. And weirdly seems to be growing every time I run the workflow!
My plan was to use the contents of my array, pipe it in to the body of an email and send it. But what I am getting is not really useful information.
So, can anyone tell me what information I am actually getting? And is it possible to get the stuff I actually wrote out to the log in to a variable in my workflow so I can do something with it?
My system is
vCO Appliance 5.5.2
Build 1946710
Thanks in advance!
Ben