Closed KrunchMuffin closed 8 years ago
anyone?
@KrunchMuffin checkpoints should work "out of the box". Can you try going to the listener test page and trigger a message? The test message will include a checkpoint that should be visible on the report. ( settings -> BugLog Listeners -> Test )
I got the exact same blank checkpoint table
Would really like to find out what is going on?
that is very strange. You could try setting other things on the request
scope and then do cfdump
s in several places to see where it is being wiped out.
Could it be that the buglog client is being reinitialized?
I set it once in app scope, I don't think it would be getting reset.
I set up a test page with just this code
<cfset application.buglog.checkpoint("test checkpoint")>
<cfdump var="#request#">
<cftry>
<cfset foo = x>
<cfcatch>
<cfset application.buglog.notifyService("Test BL", cfcatch, request)>
</cfcatch>
</cftry>
__buglog_checkpoints__
was empty array
and checkpoints was blank
what if you dump requests. __buglog_checkpoints__
on each call to checkpoint
and then call it multiple times?
so this
<cfset application.buglog.checkpoint("test checkpoint")>
<cfdump var="#request.__buglog_checkpoints__#">
<cfset application.buglog.checkpoint("test checkpoint2")>
<cfdump var="#request.__buglog_checkpoints__#">
<cfset request["__buglog_checkpoints__"] = []>
<cfset request["__buglog_checkpoints__"][1] = {ts=gettickcount(),cp="foo"}>
<cfset application.buglog.checkpoint("test checkpoint3")>
<cfdump var="#request.__buglog_checkpoints__#">
yields this
I am correct in assuming that this code is NOT putting checkpoints back into the request scope?
<cffunction name="checkpoint" access="public" returntype="void" hint="marks a checkpoint in the current request">
<cfargument name="checkpoint" type="string" required="true">
<cfscript>
var checkpoints = getCheckpoints();
var item = {
ts = getTickCount(),
cp = arguments.checkpoint
};
arrayAppend(checkpoints, item);
</cfscript>
</cffunction>
as soon as I add this after </cfscript>
, it works.
<cfset request[checkpointsKey] = checkpoints>
Well, it is supposed to be operating on a reference to the array on the request scope, and so far since this code was released, it always worked as expected.
It looks like something is making it pass the variable by value instead of by reference on the call to getCheckpoints()
I am on CF11. I am sure someone must be using checkpoints on CF11 as well?
Was justing reading up and from what I can tell Arrays are always passed by value.
Arrays are complex data types, but for historical reasons (and - IMO - a bad decision on the part of Macromedia's CF team) arrays are actually passed by value in ColdFusion.
http://blog.adamcameron.me/2012/08/complex-data-types-in-cf-and-how-theyre.html http://www.bennadel.com/blog/275-passing-arrays-by-reference-in-coldfusion---sweeet.htm
But doesn't explain how it can be working for others?
hmm, I do most of my dev on Railo so that may be a difference.
ahhh, yes, Railo did fix that...
in any case it should be an easy fix. I can do an update to the checkpoints, or if you send me a PR that might be faster :)
ok, PR sent #138
Merged into release 1.8.8 https://github.com/oarevalo/BugLogHQ/releases/tag/v.1.8.8
Thanks!
I have them set up. Do I have to do something special?
Setting it like so
<cfset application.buglog.checkpoint("gatewayTransaction")>