Hi,
I'm trying to log a message from a javascript file: my-tasks.js. I'm using the following code inside an Alfresco Share amp:
Alfresco.logger.warn("Kenneth Venken has succesfully logged a warning");
I've enabled client-debug in share-config.xml (Debug menu was added to main menu) but nothing is shown in my console or in any other log file. I've also set the log4j properties to:
# Web Framework log4j.logger.org.springframework.extensions.webscripts=info log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=debug log4j.logger.org.springframework.extensions.webscripts.ScriptDebugger=info
Where are these Alfresco.logger messages logged and what should I do to enable them?
Solved! Go to Solution.
So i found the solution. I had to enable client-debug in C:\alfresco-community\tomcat\shared\classes\alfresco\web-extension\share-config-custom.xml
<!-- Global config section --> <config replace="true"> <flags> <!-- Developer debugging setting to turn on DEBUG mode for client scripts in the browser --> <client-debug>true</client-debug> <!-- LOGGING can always be toggled at runtime when in DEBUG mode (Ctrl, Ctrl, Shift, Shift). This flag automatically activates logging on page load. --> <client-debug-autologging>true</client-debug-autologging> </flags> </config>
After a restart of tomcat the debug menu enabled and a log4javascript popup window showed up
Hi!
As a workaround you can use:
logger.system.out("Your message");
You can see your message in tomcat/logs/catalina.out or if you are using Alfresco as a service, you will be able to find it under alfrescotomcat-stdout.log
Note: client-debug must be enabled
Or you would have to configure your log4j properties using OOTBee Support Tools console add-on (even you have a javasript console that you can use too).
Cheers!
Ok, so i don't see my log message showing up in tomcat/logs/catalina.2021-09-01.log or tomcat/logs/alfrescotomcat-stdout.2021-09-01.log (Nor is there a catalina.out file and i have client-debug enabled.)
Using logger.system.out('My message') results in a console error message: logger is undefined.
If I type Alfresco.logger.isDebugEnabled() in the console it returns false. Is this an indication that some settings are wrong for debug to work? I have no idea what to try next, any help is much appreciated.
If i go to /share/page/api/javascript/debugger it says that alfresco javascript debugger is currently disabled. If i press the enable button i get a 500 -internal error.
C:\alfresco-community\tomcat\webapps\share\WEB-INF\classes\alfresco\share-config.xml:
<!-- Global config section --> <config> <flags> <!-- Developer debugging setting to turn on DEBUG mode for client scripts in the browser --> <client-debug>true</client-debug> <!-- LOGGING can always be toggled at runtime when in DEBUG mode (Ctrl, Ctrl, Shift, Shift). This flag automatically activates logging on page load. --> <client-debug-autologging>true</client-debug-autologging> <!-- When this is set to true any Aikau based errors will be posted back to the server and captured by the server side logging. This can be useful to detect when errors occur in a users browser --> <post-client-debug>true</post-client-debug> </flags>
So i found the solution. I had to enable client-debug in C:\alfresco-community\tomcat\shared\classes\alfresco\web-extension\share-config-custom.xml
<!-- Global config section --> <config replace="true"> <flags> <!-- Developer debugging setting to turn on DEBUG mode for client scripts in the browser --> <client-debug>true</client-debug> <!-- LOGGING can always be toggled at runtime when in DEBUG mode (Ctrl, Ctrl, Shift, Shift). This flag automatically activates logging on page load. --> <client-debug-autologging>true</client-debug-autologging> </flags> </config>
After a restart of tomcat the debug menu enabled and a log4javascript popup window showed up
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.