Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
486 views
in Technique[技术] by (71.8m points)

logging - IBM Worklight 6.0 - How to enable/view WL.Logger.debug in adapters?

I have implemented the following simple HTTP adapter in order to introduce myself to Worklight Adapters. It works correctly.

However, I can't see in the Eclipse Worklight console my WL.logger.debug statements!

I've tried to configure logging.properties and server.xml as shown in this Information Center article, but it doesn't show the debug lines (request and result).

Any suggestions?

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;
        }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

WebSphere Liberty profile does not support debug level logging in the Worklight Development Server Console view.

You can use WL.Logger.debug and edit server.xml to view the log in the trace.log file

  1. Open the Servers view in Eclipse
  2. Expend the Worklight Development Server entry
  3. Double-click on Server Configuration (server.xml)
  4. Switch to Source tab
  5. Uncomment this line: <logging traceSpecification="com.worklight.*=debug=enabled"/>
  6. After invoking your adapter procedure you will find the log at <eclipseWorkspace>WorklightServerConfigserversworklightlogsrace.log

Be sure to re-deploy the adapter before attempting to view the logs.

Alternatively,
You can use WL.Logger.warn or WL.Logger.error; these logs will display in the Worklight Development Server Console view.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...