oarevalo / BugLogHQ

BugLogHQ is a tool to centralize the handling of automated bug reports from multiple applications. BugLogHQ provides a unified view of error messages sent from any number of applications, allowing the developer to search, graph, forward, and explore the bug reports submitted by the applications.
http://www.bugloghq.com
154 stars 67 forks source link

Checkpoints not working? #135

Closed KrunchMuffin closed 8 years ago

KrunchMuffin commented 8 years ago

I have them set up. Do I have to do something special?

Setting it like so <cfset application.buglog.checkpoint("gatewayTransaction")>

image

KrunchMuffin commented 8 years ago

anyone?

oarevalo commented 8 years ago

@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 )

KrunchMuffin commented 8 years ago

I got the exact same blank checkpoint table

KrunchMuffin commented 8 years ago

Would really like to find out what is going on?

oarevalo commented 8 years ago

that is very strange. You could try setting other things on the request scope and then do cfdumps in several places to see where it is being wiped out. Could it be that the buglog client is being reinitialized?

KrunchMuffin commented 8 years ago

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

oarevalo commented 8 years ago

what if you dump requests. __buglog_checkpoints__ on each call to checkpoint and then call it multiple times?

KrunchMuffin commented 8 years ago

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

image

KrunchMuffin commented 8 years ago

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>
oarevalo commented 8 years ago

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()

KrunchMuffin commented 8 years ago

I am on CF11. I am sure someone must be using checkpoints on CF11 as well?

KrunchMuffin commented 8 years ago

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?

oarevalo commented 8 years ago

hmm, I do most of my dev on Railo so that may be a difference.

KrunchMuffin commented 8 years ago

ahhh, yes, Railo did fix that...

oarevalo commented 8 years ago

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 :)

KrunchMuffin commented 8 years ago

ok, PR sent #138

oarevalo commented 8 years ago

Merged into release 1.8.8 https://github.com/oarevalo/BugLogHQ/releases/tag/v.1.8.8

KrunchMuffin commented 8 years ago

Thanks!