Remove unneeded logs

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

GrinReaper
Posts: 43
Joined: 06 Aug 2012, 09:48

Remove unneeded logs

Postby GrinReaper » 12 Jul 2016, 05:59

We are getting these logs printed frequently whenever we use the client and it hampers ours debugging effort since it creates an unnecessary clutter among the logs that we need to debug.

Code: Select all

Handling Header Size. Length: 376 (small)
14:53:55,583 INFO  [sfs2x.client.core.SFSIOHandler] (New I/O  worker #1) Data size is 94
14:53:55,583 INFO  [sfs2x.client.core.SFSIOHandler] (New I/O  worker #1) Handling Data: 374, previous state: 0/94
14:53:55,583 INFO  [sfs2x.client.core.SFSIOHandler] (New I/O  worker #1) <<< Packet Complete >>>
14:53:55,584 INFO  [sfs2x.client.core.SFSIOHandler] (New I/O  worker #1) Handling New Packet of size 280
14:53:55,584 INFO  [sfs2x.client.core.SFSIOHandler] (New I/O  worker #1) Handling Header Size. Length: 279 (small)


Is there any way to stop the client from printing these logs so that we can have only our own logs in the log file and the console?
User avatar
Lapo
Site Admin
Posts: 19986
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Remove unneeded logs

Postby Lapo » 12 Jul 2016, 07:31

Hi,
the SmartFox class constructor takes one Boolean parameter that toggles the debug info. You can use:

Code: Select all

SmartFox sfs = new SmartFox(false);
Lapo
--
gotoAndPlay()
...addicted to flash games
GrinReaper
Posts: 43
Joined: 06 Aug 2012, 09:48

Re: Remove unneeded logs

Postby GrinReaper » 12 Jul 2016, 09:13

We've already used set the debug flag as false in the code. But we're still getting the logs that I've mentioned. The other SFS logs are not printed, but only those lines still keep getting printed.
User avatar
Lapo
Site Admin
Posts: 19986
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Remove unneeded logs

Postby Lapo » 12 Jul 2016, 13:37

Are you using the ConfigData object to start the connection? If so make sure to also set ConfigData.isDebug = false

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
GrinReaper
Posts: 43
Joined: 06 Aug 2012, 09:48

Re: Remove unneeded logs

Postby GrinReaper » 13 Jul 2016, 06:18

This is the code that we use to connect:

Code: Select all

sfs = new SmartFox(false);
sfs.connect("192.168.132.25",9933);


We're not using ConfigData object to connect. :?
User avatar
Lapo
Site Admin
Posts: 19986
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Remove unneeded logs

Postby Lapo » 13 Jul 2016, 07:44

Try using this instead:

Code: Select all

ConfigData cd = new ConfigData();
cd.setHost("192.168.132.25");
cd.setDebug(false);

sfs.connect(cd);


Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
GrinReaper
Posts: 43
Joined: 06 Aug 2012, 09:48

Re: Remove unneeded logs

Postby GrinReaper » 13 Jul 2016, 09:11

Even that didn't work. We're still getting the logs. :(
User avatar
Lapo
Site Admin
Posts: 19986
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Remove unneeded logs

Postby Lapo » 13 Jul 2016, 10:38

What version of the Java API are you using?
I'd recommend using the latest, if you're not up to date:
http://smartfoxserver.com/download/sfs2x#p=client

I am testing with the current version (1.6.1) and I can't reproduce the problem you have reported.

Let us know.
Lapo

--

gotoAndPlay()

...addicted to flash games
GrinReaper
Posts: 43
Joined: 06 Aug 2012, 09:48

Re: Remove unneeded logs

Postby GrinReaper » 13 Jul 2016, 12:32

Can you provide us with the test application that you've written? We'd like to compare the code with ours and see what we're doing differently.
User avatar
Lapo
Site Admin
Posts: 19986
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Remove unneeded logs

Postby Lapo » 13 Jul 2016, 15:07

Sure, here it is:

Code: Select all

package sfs2xjavaclienttest;

import com.smartfoxserver.v2.exceptions.SFSException;
import sfs2x.client.SmartFox;
import sfs2x.client.core.BaseEvent;
import sfs2x.client.core.IEventListener;
import sfs2x.client.core.SFSEvent;
import sfs2x.client.requests.LoginRequest;
import sfs2x.client.util.ConfigData;

public class SFS2XJavaClientTest
{
    SmartFox sfs;

    public SFS2XJavaClientTest()
    {
        sfs = new SmartFox();
        sfs.addEventListener(SFSEvent.CONNECTION, new IEventListener() {
            @Override
            public void dispatch(BaseEvent be) throws SFSException {
                System.out.println("Connected");
               
                sfs.send(new LoginRequest(""));
            }
        });
       
        sfs.addEventListener(SFSEvent.LOGIN, new IEventListener() {
            @Override
            public void dispatch(BaseEvent be) throws SFSException {
                System.out.println("Logged in as: " + sfs.getMySelf().getName());
            }
        });
       
        ConfigData cfg = new ConfigData();
        cfg.setHost("localhost");
        cfg.setZone("BasicExamples");
        cfg.setDebug(false);
       
        System.out.println("API Version: " + sfs.getVersion());
       
        sfs.connect(cfg);
    }
   

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        new SFS2XJavaClientTest();
    }
}


Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
GrinReaper
Posts: 43
Joined: 06 Aug 2012, 09:48

Re: Remove unneeded logs

Postby GrinReaper » 14 Jul 2016, 09:28

So, we managed to solve the issue.

The first problem was that we were using an old version of the SFS2X Java client API. So, we downloaded the latest API and tried to use it. Then, we learned that we need to use Java 1.7 instead of Java 1.6 which is what we were using. We updated Java and everything was alright in the world again!

Thank you :)
User avatar
Lapo
Site Admin
Posts: 19986
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Remove unneeded logs

Postby Lapo » 14 Jul 2016, 09:35

Sorry, I should have probably asked earlier what version you were using ... In any case I am glad you figured it out. :)

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 1 guest