cancel
Showing results for 
Search instead for 
Did you mean: 

Share Webscript Logging

jgunter505
Champ in-the-making
Champ in-the-making
I am creating a dashlet and I'd like to do some logging in the foo.get.js file.  I have a "logger.log("Foo");" statement that I'd like to see when the dashlet is executed, but I'm not seeing it in the logs.

I have changed the client-debug value in share-custom-config.xml to true, but I'm still not seeing any logging statements (even after restarting).

Any thoughts on how to get this going for Share?  I am using Alfresco 5.0.

3 REPLIES 3

darkredd
Star Contributor
Star Contributor
Hi,

Enable script debug logging in the log4j.properties files of each app module (i.e. alfresco and share).

jgunter505
Champ in-the-making
Champ in-the-making
Thank you for the response, but unfortunately that didn't work for me.

I have the following in my log4j.properties file:

log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=debug
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug

I have placed this properties file in conifg/alfresco/module/{module_id}, but I'm still not seeing any logging for my dashlet.

Perhaps I didn't use the right property or placed the file in the wrong spot, but still looking for the answer.

rjohnson
Star Contributor
Star Contributor
If you just want this for debugging your script, then use logger.error("my message"); this will write to the logs without changing the log level.When you have debugged, remove the logger.error statements

The problem I find with changing the log level is that all webscripts then go to debug and that generates a lot of log entries (especially the SOLR scripts) and that makes your own personal ones hard to see.

If you do want to change the log levels I always edit

tomcat/webapps/alfresco/WEB-INF/classes/log4j.properties

Setting

log4j.logger.org.alfresco.repo.web.scripts=debug
log4j.logger.org.alfresco.repo.jscript=debug
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug


and

tomcat/webapps/share/WEB-INF/classes/log4j.properties

Setting

#log4j.logger.org.alfresco.repo.jscript=debug
#log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug

Restart Alfresco of course and then you should see your debug messages along with all the other ones.