master
parent
dc56248320
commit
e6f4bf340c
2
pom.xml
2
pom.xml
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>cn.cloudowr</groupId>
|
||||
<artifactId>sdk</artifactId>
|
||||
<version>1.4.14</version>
|
||||
<version>1.4.15</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ public class Logger {
|
|||
|
||||
//用来自动连接的,不想自动连接请设为null
|
||||
private static ReconnConf<Object, Message, Object> reconnConf = new ReconnConf<Object, Message, Object>(5000L);
|
||||
|
||||
private static ClientChannelContext<Object, Message, Object> clientChannelContext;
|
||||
|
||||
public static void initLogger() throws Exception {
|
||||
String serverIp = "log.cloudowr.cn";
|
||||
String serverIp = "127.0.0.1";
|
||||
int serverPort = Const.PORT;
|
||||
serverNode = new Node(serverIp, serverPort);
|
||||
aioClientHandler = new BaseClientAioHandler();
|
||||
|
|
@ -38,14 +38,15 @@ public class Logger {
|
|||
|
||||
clientGroupContext = new ClientGroupContext<>(aioClientHandler, aioListener, reconnConf);
|
||||
aioClient = new AioClient<>(clientGroupContext);
|
||||
|
||||
clientChannelContext = aioClient.connect(serverNode);
|
||||
}
|
||||
|
||||
public static void log(String msg) {
|
||||
try {
|
||||
ClientChannelContext<Object, Message, Object> clientChannelContext= aioClient.connect(serverNode);
|
||||
Message packet = new JSONStringMessage(msg.getBytes(Message.CHARSET));
|
||||
Aio.send(clientChannelContext, packet);
|
||||
} catch (Exception e) {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue