我已经实现了以下简单的HTTP适配器,以便将自己介绍给Worklight Adapters。它工作正常。
但是,我无法在Eclipse Worklight控制台中看到我的WL.logger.debug
语句!
我尝试配置logging.properties和server.xml,如图in this Information Center article所示,但它没有显示调试行(请求和结果)。
有什么建议吗?
JS:
function currencyConvertor(data) {
var request =
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ConversionRate xmlns="http://www.webserviceX.NET/">
<FromCurrency>{data.fromCurrency}</FromCurrency>
<ToCurrency>{data.toCurrency}</ToCurrency>
</ConversionRate>
</soap:Body>
</soap:Envelope>;
WL.Logger.debug("request start ---------");
WL.Logger.debug(request);
WL.Logger.debug("request end --------");
var input = {
method : 'post',
returnedContentType : 'xml',
path : '/CurrencyConvertor.asmx',
body: {
content: request.toString(),
contentType: 'text/xml; charset=utf-8'
}
};
var result = WL.Server.invokeHttp(input);
WL.Logger.debug("result start ---------");
WL.Logger.debug(result);
WL.Logger.debug("result end --------");
return result.Envelope.Body;
}
答案 0 :(得分:8)
WebSphere Liberty概要文件不支持Worklight Development Server Console视图中的调试级别日志记录。
您可以使用WL.Logger.debug
并修改server.xml
来查看trace.log
文件中的日志
<logging traceSpecification="com.worklight.*=debug=enabled"/>
<eclipseWorkspace>\WorklightServerConfig\servers\worklight\logs\trace.log
在尝试查看日志之前,请务必重新部署适配器。
可替换地,
您可以使用WL.Logger.warn
或WL.Logger.error
;这些日志将显示在Worklight Development Server控制台视图中。
答案 1 :(得分:1)
尝试使用WL.Server.info()而不是.debug()。 总的来说 - 看到这篇博客文章,它解释了很多关于调试和日志记录的内容 https://www.ibm.com/developerworks/community/blogs/worklight/entry/logging_and_debugging_on_worklight_server?lang=en