08-31-2021 07:03 AM
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?
09-01-2021 06:03 AM
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
08-31-2021 07:44 AM
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!
09-01-2021 04:47 AM
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.
09-01-2021 05:37 AM
09-01-2021 05:44 AM
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>
09-01-2021 06:03 AM
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
09-01-2021 06:18 AM
Explore our Alfresco products with the links below. Use labels to filter content by product module.