Results 1 to 10 of 10

Hybrid View

  1. #1

    lsClient.setLoggerProvider(loggerProvider) is not a function

    Hi,

    I'm trying to user SimpleLoggerProvider to log info from lightstreamer JS client. As i have followed the JSdoc but having weired exception which is setLoggerProvider is not a function.

    Does anyone know the reason? Thanks in advance.

    Regards
    Shabbir

  2. #2
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,

    setLoggerProvider is a static method:


    HTH

  3. #3
    Quote Originally Posted by Mone View Post
    Hi,

    setLoggerProvider is a static method:


    HTH
    Hi Mone,

    Thanks for the info. But the way i'm using the logger is below,

    define("lsClient",["LightstreamerClient"],function(LightstreamerClient) {
    var lsClient = new LightstreamerClient(); lsClient.connectionDetails.setServerAddress("${PRE SSESSIONINFORMATION.pushProtocol}://${PRESSESSIONINFORMATION.pushDomain}:${PRESSESSION INFORMATION.pushPort}");
    lsClient.connectionDetails.setAdapterSet("ASADAPTE RSET");
    lsClient.connectionDetails.setUser('${PRESSESSIONI NFORMATION.sessionId}');
    lsClient.connectionDetails.setPassword('${PRESSESS IONINFORMATION.domainInstance.topLevelDomain}');
    lsClient.connectionSharing.enableSharing("auctione erScreen","ATTACH","CREATE");
    lsClient.connect();
    return lsClient;
    });

    require(["lsClient","Subscription", "StaticGrid", "SimpleLoggerProvider", "RemoteAppender", "LogMessages"],
    function(lsClient,Subscription, StaticGrid, SimpleLoggerProvider, RemoteAppender,LogMessages) {

    try
    {
    var loggerProvider = new SimpleLoggerProvider();
    lsClient.setLoggerProvider(loggerProvider);
    var myAppender = new RemoteAppender("INFO","*", lsClient);
    loggerProvider.addLoggerAppender(myAppender);

    var customLogger = loggerProvider.getLogger("*");
    customLogger.info("Test Log", null);
    .....
    .....
    .....

    lsClient.subscribe(auctionSubscription);

    }
    catch (err)
    {
    }
    });

    How can i use it here?

  4. #4
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    You can't use it that way because lsClient.setLoggerProvider does not exists. setLoggerProvider is not a property of LightstreamerClient.prototype, is a property of LightstreamerClient itself

    Check section 2.6.3 of the following document for a working example:
    http://www.lightstreamer.com/latest/...nt%20Guide.pdf



  5. #5
    Quote Originally Posted by Mone View Post
    You can't use it that way because lsClient.setLoggerProvider does not exists. setLoggerProvider is not a property of LightstreamerClient.prototype, is a property of LightstreamerClient itself

    Check section 2.6.3 of the following document for a working example:
    http://www.lightstreamer.com/latest/Lightstreamer_Allegro-Presto-Vivace_5_1_Colosseo/Lightstreamer/DOCS-SDKs/sdk_client_javascript/doc/JavaScript%20Client%20Guide.pd


    Thanks Mone, I didn't recognize that. But now having the problem with the second part when i use RemoteAppender when running lightstreamer locally (Realtime screen freezes). If i cannot test remote appender in dev env then how can i test the remote appender? Also, do you know what is the usage of the category in the getLogger? Suppose lightstreamer.stream. Do you have any example for logger in JS Client?
    Thanks in advance.

    var loggerProvider = new SimpleLoggerProvider();
    LightstreamerClient.setLoggerProvider(loggerProvid er);
    var myAppender = new ConsoleAppender("INFO","*", lsClient);
    loggerProvider.addLoggerAppender(myAppender);

    var customLogger = loggerProvider.getLogger("lightstreamer.stream");
    //var customLogger = loggerProvider.getLogger("*");
    customLogger.info("Test Log", null);
    Last edited by shabbirh; October 17th, 2013 at 12:27 PM.

  6. #6
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,

    sorry for the late answer.
    The browser freeze when loggin * at INFO level because the RemoteLogger itslef exploits the internal classes of the Lightstreamer library to send the messages to the server. Doing so it triggers some more INFO log that needs to be sent and thus it starts a loop of messages: too many for the client to be handled.
    I'll evaluate what to do to fix the issue, in the meanwhile avoid the use of the RemoteLogger at INFO level and set it to ERROR. Sorry.

    As per the categories there is a description here: http://www.lightstreamer.com/docs/cl...html#getLogger

    Anyway we have open-sourced all the log layer (excluding the RemoteLogger class).
    Note that the code in the Lightstreamer library may be currently different and that you probably can't make the current library use this new project, still you can include it alongside the library if it fits your needs.
    See https://github.com/Weswit/utility-logging-javascript

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 08:53 PM.