Closed ivanionut closed 8 years ago
I think the problem is because it is missing the init method call after the createObject
Hi Oscar, How should I set it to initialize? This way gives me blank page when an error occurs.
var bl = createObject("component", "bugLog.client.bugLogService").init("/bugLog/listeners/listener.cfc");
bl.notifyService(e.message, e);
Thanks, Ivan
The listener argument to the init
method needs to be a full URL. For example:
var bl = createObject("component", "bugLog.client.bugLogService")
.init("http://localhost/bugLog/listeners/listener.cfc");
bl.notifyService(e.message, e);
Replace http://localhost/
with whatever is appropriate for your setup.
Oscar
Ok, but now I get this error:
The problem is that the website is https
I modified in this bugLogService.cfc
manner:
variables.protocol = "CFC";
Now BugLogHQ does not give me any error. But it does not log application error...
No idea on how to solve this problem?
Hey Ivan, The idea of BugLogHQ is that it will typically be called from "the outside". So, several applications could be running the BugLogHQ client component, all pointing to a single central BugLogHQ server. Then anytime there is an error on any of the applications or servers, they will all be aggregated together.
Therefore the "listener" argument to the the bugLog.client.bugLogService
instance should be any URL on which the BugLog server can be accessed from the outside.
For example, if you are running on your local server, this could be:
http://localhost/bugLog/listeners/listener.cfc
or if you want to reach a server that has a full domain and https enabled:
https://my.domain.com/bugLog/listeners/listener.cfc
Now, there is also another way in which you can access BugLog, but this can only be used when the BugLog server and the monitored application are running in the same ColdFusion instance. In that case you use the CFC
protocol. When you use this mode, the listener address should now be the fully qualified cfc path to the listener.cfc
component.
For example:
bugLog.listeners.listener
Basically this would be the argument used on a createObject
statement to create an instance of the listener
object.
Hopefully this clarifies your situation a bit.
Ok. Now everything is much clearer.
Now I have tried so:
try {
// another code
} catch( Any e ){
var bl = createObject("component", "bugLog.client.bugLogService").init("bugLog.listeners.listener");
bl.notifyService(e.message, e);
}
but I get this other error: variable [SERVICELOADER] doesn't exist
Do you have the strict var scoping enabled? I'm thinking that this may be due to a missing var
statement here: https://github.com/oarevalo/BugLogHQ/blob/master/listeners/listener.cfc#L7
Can you try adding the missing var
to that line and test again? I'll be making a patch shortly.
I tried:
<cfset var serviceLoader = createObject("component", "bugLog.components.service").init( instanceName = variables.instanceName )/>
but the error always remains the same as before.
This is Lucee Settings - Scope
Meaning that you still get the "serviceLoader doesn't exist' error?
oh no, silly me. I gave you the wrong suggestion. The correct line should be:
<cfset variables.serviceLoader = createObject("component", "bugLog.components.service").init( instanceName = variables.instanceName )/>
By using var
it becomes a local variable to the init()
function. What we need is to make it an instance variable.
<cfset variables.serviceLoader = createObject("component", "bugLog.components.service").init( instanceName = variables.instanceName )/>
same error: variable [SERVICELOADER] doesn't exist
That's weird. Maybe you can drop a cfdump / cfabort right after the createObject line to dump the serviceLoader
object and make sure it is being created.
Not sure what else it could be.
neither dump / abort
does not work ... I included this but the page do not show the dump. It only displays the error first (variable [SERVICELOADER] doesn't exist)
it is as if he ignoring the init()
function...
<cffunction name="init" access="public" returntype="listener">
<cfargument name="instanceName" type="string" required="true">
<cfset variables.instanceName = arguments.instanceName>
<cfset variables.serviceLoader = createObject("component", "bugLog.components.service").init( instanceName = variables.instanceName )/>
<cfscript>
return writeDump(variables.serviceLoader);
abort;
</cfscript>
<cfreturn this>
</cffunction>
you could try without the return
. just do:
<cfdump var="#variables.serviceLoader#">
<cfabort>
Nothing. Does not show the dump...
<cffunction name="init" access="public" returntype="listener">
<cfargument name="instanceName" type="string" required="true">
<cfset variables.instanceName = arguments.instanceName>
<cfset variables.serviceLoader = createObject("component", "bugLog.components.service").init( instanceName = variables.instanceName )/>
<cfdump var="#variables.serviceLoader#">
<cfabort>
</cffunction>
Ok I think i finally understand what is happening. When you use the CFC protocol, the listener
instance is created by the client, but the init()
method is never called. Therefore the serviceLoader
is never initialized (and that's also why you don't see the abort/dump). The serviceLoader is relatively recent addition to BugLog and since the CFC protocol is very rarely used, that may explain why it was overlooked.
There is a couple of things you can do short term.
.init()
in the BugLog client service when the listener CFC is instantiated. The argument is the instance name. Try empty string, and if that doesnt work or throws an error, use default
Ok. Now I try to move BugLogHQ in a subdomain "bugs.website.it
". After I inform you if I have solved.
1) I created a neat installation inside the subdomain bugs.webiste.it/bugLog/
In bugLog page admin webpage:
BugLogListener Service is: Stopped
When I click on start:
Error! invalid component definition, can't find component [listener]
2) on production web site I just saved the component ’bugLogService
.cfc’
try {
…
} catch( Any e ){
var bl = createObject("component", "components.bugLogService").init("http://bugs.website.it/bugLog/listeners/bugLogListenerREST.cfm");
bl.notifyService(e.message, e);
}
3) On the production site when emulating an error:
you gave up? :laughing:
Now if I click on "start": invalid component definition, can't find component [components.bugLogListenerAsync]
(I have not made any changes)
Hey Ivan, sorry for the delay. Can you try accessing "http://bugs.website.it/bugLog/listeners/bugLogListenerREST.cfm" on your browser or via curl? See if you get an error, or some kind of response.
On your config file (/bugLog/config-config.xml.cfm
) what is the value of service.serviceCFC
?
Also, do you have buglog installed in a directory named bugLog
in your webroot?
I have now set up well:
<setting name="service.serviceCFC">bugLog.components.bugLogListenerAsync</setting>
Do you believe if I tell you right now work? :satisfied: :satisfied:
You were very kind and very helpful! Thank you so much for the help! :+1:
Yay! :)
I'm glad it's working now. Feel free to open a new ticket here if you run into any more issues, or have any questions.
Thanks for trying out BugLogHQ!
Hi, I downloaded the latest version from github, I configured the
buglog-config.xml.cfm
files, I created the db and I entered in the admin area (/bugLog/hq/?event=admin.main
). Everything works until now.I added:
I intentionally caused an error in my app (to see if bugLog works), but I get this error:
What can it be?