How to use SocketManager?

Notes, tips, and other usefull things on how to use LogMX

Moderator: admin

Post Reply
roey
Posts: 7
Joined: Wed Jul 08, 2015 7:01 pm

How to use SocketManager?

Post by roey »

Hi,
I'm trying to use the SocketManager option on TCP. While I think the Log4J2 client connects to the port, I don't see any logs on the LogMX GUI.

Here is what I do:

1. log4j2.xml contains:
<Socket name="tcp" host="127.0.0.1" port="5000">
<SerializedLayout />
</Socket>

2. start LogMX and select Socket Manager option
3. I'm not sure what to put into the log4j pattern parser tab. so I just put %m%n which is recognized as "Message"
4. start the socket manager on port 5000, with "serialized" ticked.
5. a new tab opens with "sock://TCP:5000/s=1" at the top

now I run a simple test program. it seems to connect to the port, but I don't see any logs appearing.
BTW, when the test program exits "EOFException" appears at the status tab at the bottom of LogMX.

Any advice?

cheers!
--roy
roey
Posts: 7
Joined: Wed Jul 08, 2015 7:01 pm

Re: How to use SocketManager?

Post by roey »

found how to make it work by not using the SerializedLayout.

1. log4j2.xml updated with
<Socket name="tcp" host="127.0.0.1" port="5000">
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</Socket>
2. using the same pattern in the logmx pattern tab

now it works.

not sure about SerializedLayout and why it didn't work, but I have now a working setup :->
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: How to use SocketManager?

Post by admin »

Hello Roy,

When using "serialized" logs, Log4j doesn't send text, but binary data, so there is no need to configure a Parser, because there is nothing to parse.
Instead, you shall ensure that you have copied your Log4j JARs into LogMX "lib" directory, so that LogMX can ask Log4j to read log entries from received binary data. It is highly recommended to copy the exact Log4j JARs that were used by the application that sent the logs, because serialization/deserialization might change over Log4j versions. To help you in this operation, you can use the table displayed in the "Open logs" window, when selecting the SocketManager:
  • green light => everything is fine
  • orange => need JAR
  • red => not supported
You shall focus on the highlighted line of this table, and the column "Log4j v2". If you click on this green/orange/red light, you will get some more help.

Please let me know if you still have trouble using serialized logs.

Xavier
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: How to use SocketManager?

Post by admin »

I was just thinking: if you didn't see this in LogMX while waiting for incoming logs:
Image
Then it means you actually didn't receive anything, then you might want to double-check your IP/port settings in Log4j configuration and on LogMX side (sometimes "localhost" or "127.0.0.1" don't work, so I would suggest trying both)
Post Reply