AnsweredAssumed Answered

Javascript Debugger - Alfresco One on CentOS

Question asked by beber7 on Jun 3, 2016
Latest reply on Jun 8, 2016 by beber7
Hi guys,

I'm pretty new in the Alfresco world.
I'm trying to do something simple and I keep hitting blockers. I wonder if I do something wrong or if something is broken. He is the problem description :

Background :
I want to create a Javascript script to perform actions on a document when document enter a certain folder.
I did create my rule for a the folder I wanted to interact with. I did put my JS file in Repository > Data Dictionary > Scripts
But my script doesn't work. No panic, I just need to debug it and here is the problem…

Goal :
Being able to debug this JS script.

What I've tried :
1) going on http://<ADDR>:<PORT>/alfresco/service/api/javascript/debugger and click activate. Then I got an not very helpfull error 500.

Here is the complete message :
<cite>An error has occured in the API: /alfresco/service/api/javascript/debugger.
It responded with a status of 500 - Internal Error.
Error Code Information: 500 - An error inside the HTTP server which prevented it from fulfilling the request.
Error Message: 05030001 Wrapped Exception (with status template): null
Server: Alfresco Enterprise v5.0.1 (.5 r108957-b87) schema 8,022
Time: Jun 3, 2016 8:02:34 AM
Click here to view full technical information on the error.
Exception: org.springframework.extensions.webscripts.WebScriptException - 05030001 Wrapped Exception (with status template): null
org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1126)
</cite>

2) I tried to locate the famous log4j.properties to activate the debug functionnality and have the script writting into my Chrome Console.
I went to  /opt/alfresco-5.0.1.5/tomcat/webapps/alfresco/WEB-INF/classes/log4j.properties
I tried to modify the following properties ( the rest of the file is default )
<cite>- log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug (previously warn)
- log4j.logger.org.alfresco.repo.web.scripts.AlfrescoRhinoScriptDebugger=debug (previously off)</cite>

I get an error 500 on the page, and can't even log in alfresco any more when this configuration apply.
I'm pretty sure I'm doing something wrong since I'm ensure of what I'm doing.

I'm running Alfresco on a CentOS v7.
Also, I'm a little confused with what I'm using… The install path says Alfresco, the URL says Share and on the website footer says ALfresco One.

I'm stuck on this, I read an interesting topic about the same 500 issue, but someone made a batch script for windows to solve it. I also read this debug option might not work on some unix for some version for unknown reasons yet.
If anyone have the solution or have the proper documentation to follow for my specific case, it will be helpful.

Goal summary :
- Have a print in the Browser console ( Or at least in a log file ) of a JS script called on a Rule, triggered when a document is pushed into a folder lacated in my repo.

My script file contain the following log lines :
<javascript>
logger.log("Test OK");
logger.warn("Test warn OK");
</javascript>

PS: I know the script is called, because I get an error when I upload a file if I pushed a broken JS file.

Thanks for reading

Outcomes