我在Windows 8上使用JetBrains IntelliJ IDEA 14使用Kryonet 2.21。这是我的问题:
最近我尝试使用Kryonet编写服务器应用程序,但无论我设置哪个日志级别,日志都不会显示任何内容...... 我希望有人得到我的错 - 这是我的代码:
public class GServerConManager
{
private static final int TCPPORT = 4420;
private static final int UDPPORT = 4421;
private boolean isRunning = false;
private Server server = null;
private Kryo kryo = null;
我的对象的构造函数将Loglevel设置为“LEVEL_DEBUG”。
public GServerConManager() throws IOException
{
Log.set(Log.LEVEL_DEBUG);
this.server = new Server();
registerNetClasses();
this.server.bind(TCPPORT,UDPPORT);
this.server.addListener(new GServerListener());
}
你看到“public void start()”方法。它在Main方法中执行,但“服务器已启动!”从来没有打印在我的控制台上。
public void start()
{
if(!isRunning)
{
isRunning = true;
this.server.start();
Log.debug("Server started!");
}
这里也没有输出....
else
{
Log.debug("Sever is already running!");
}
}
在“public void stop()”方法中也是如此。
public void stop()
{
if(this.isRunning)
{
isRunning = false;
this.server.stop();
Log.debug("Server stopped!");
}
else
{
Log.debug("Server already stoppped!");
}
}
private void registerNetClasses()
{
this.kryo = this.server.getKryo();
}
}
使用Switch语句在Main方法中执行方法。 对不起,如果我的英语不是最好的,我会努力写一个易于理解的请求。 谢谢:))