Javascript logger.log未记录到alfresco.log
我试图在与Alfresco中的模板页面相对应的javascript文件中使用logger.log(“Hello”) 我设定了以下条件: -在custom-log4j.properties中(覆盖log4j.properties) 但是,当我在js文件中使用logger.log时,我发现logger没有定义 解决方案是在custom-slingshot-application-context.xml中设置以下内容Javascript logger.log未记录到alfresco.log,javascript,log4j,alfresco,Javascript,Log4j,Alfresco,我试图在与Alfresco中的模板页面相对应的javascript文件中使用logger.log(“Hello”) 我设定了以下条件: -在custom-log4j.properties中(覆盖log4j.properties) 但是,当我在js文件中使用logger.log时,我发现logger没有定义 解决方案是在custom-slingshot-application-context.xml中设置以下内容 <bean id="webframework.rendition.proces
<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>
现在使用logger.log不会给出任何错误,但它似乎没有写入位于Tomcat/bin中的alfresco.log
有人有线索吗?看起来您对什么适用于存储库和什么适用于共享感到困惑 存储库中的:
logger.log
在调试级别使用类别org.alfresco.repo.jscript.ScriptLogger
,因此custom-log4j.properties
中的内容是正确的(尽管忽略了附加项)。确保它位于类路径中的alfresco/extension
。目录tomcat/shared/classes/alfresco/extension
是您通常想要的
在共享中:
logger.log
使用类别org.springframework.extensions.webscripts.ScriptLogger
。据我所知,这里没有“custom-log4j属性配置机制”,所以您必须附加
log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=debug
要
共享/WEB-INF/classes/log4j.properties
如果您不想重新启动alfresco并在存储库中执行脚本,有另一种方法作为变通解决方案。尝试使用logger.system.out而不是logger.log,您仍然可以在catalina.out中找到日志消息。您的JS脚本在哪个上下文中运行?露天还是共享?它似乎是一个SURF/Share JS-因此默认情况下,您的日志输出将位于Share中的Share.logAd logger类别中:实际上,当您查看提到的ScriptLogger类时,它使用与存储库相同的记录器类别://注意:保持与存储库脚本记录器的兼容性
私有静态最终日志记录器=LogFactory.getLog(“org.alfresco.repo.jscript.ScriptLogger”)代码>(使用Alfresco 4.2.f测试)
log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=debug