I am trying to use logger.log("Hello") in a javascript file corresponding to a template page in Alfresco.
I have set the following: - in custom-log4j.properties (overriding log4j.properties)
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=alfresco.log
log4j.appender.File.Append=true
log4j.appender.File.DatePattern='.'yyyy-MM-dd
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
log4j.logger.org.alfresco.repo.web.scripts=warn
log4j.logger.org.alfresco.repo.web.scripts.BaseWebScriptTest=info
log4j.logger.org.alfresco.repo.web.scripts.AlfrescoRhinoScriptDebugger=off
log4j.logger.org.alfresco.repo.jscript=debug
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug
log4j.logger.org.alfresco.repo.cmis.rest.CMISTest=info
But when I use logger.log in the js file, I get logger is not defined.
The solution was to set the following in custom-slingshot-application-context.xml
<bean id="webframework.rendition.processor.webtemplate" class="org.springframework.extensions.webscripts.WebTemplateProcessor">
<property name="templateProcessorRegistry" ref="webframework.templates.registry.templateprocessor" />
<property name="scriptProcessorRegistry" ref="webframework.templates.registry.scriptprocessor" />
<property name="processorModelHelper" ref="processor.model.helper"></property>
<property name="webFrameworkConfigElement" ref="webframework.config.element"></property>
<property name="scriptObjects">
<map>
<entry key="remote" value-ref="webframework.webscripts.scriptremote" />
<entry key="stringUtils">
<bean class="org.springframework.extensions.webscripts.ScriptableUtils"/>
</entry>
<entry key="logger">
<bean class="org.springframework.extensions.webscripts.ScriptLogger"/>
</entry>
</map>
</property>
</bean>
Now using logger.log does not give any error, but it seems that it's not writing to alfresco.log which is located in Tomcat/bin
Does anybody have a clue?