Giter VIP home page Giter VIP logo

Comments (11)

huxi avatar huxi commented on May 30, 2024

Granted, the documentation is a bit confusing. Lilith is listening on both ports, 4445 an 4560, for historic reasons.

Did you check the "Lilith events" (Ctrl-0) for suspicious entries?

Another place you could check would be USER_HOME\.lilith\errors.log.

It's also possible that your application is closing too fast. The events are sent asynchronously and may get lost if the application exits. You could add an endless loop with a log statement to your main method to test if that's the reason.

There's a "Debug..." entry in the "Help" menu. If you click on "Log all!" in the Debug dialog then this should open 10 connections to Lilith originating from itself. Does this work?

from lilith.

Pesegato avatar Pesegato commented on May 30, 2024

Nope, I'm now trying with a 10 seconds sleep...

from lilith.

Pesegato avatar Pesegato commented on May 30, 2024

To recap:
lilith events shows nothing wrong
errors.log shows nothing wrong
I added 10 seconds sleep after logging before exiting
The log all opens 10 connections to lilith

But the test case above don't log anything at all... I'm considering switching to java.util.logging :(

from lilith.

Pesegato avatar Pesegato commented on May 30, 2024

Also please note that while your documentation is for localhost logging, I'm actually doing remote logging (the host field has the IP of Lilith, but the log4j2 is on another reachable IP).
Also I can confirm that the messages are sent in that I have wireshark log of them.

from lilith.

huxi avatar huxi commented on May 30, 2024

If the logs for the 10 debug connections are opening then we can at least be sure that Lilith itself is working. One of those debug connections is using serialized Logback events sent to port 4560 and Lilith doesn't care whether it's receiving serialized Logback, log4j or log4j2 events. It just converts the events as needed and should barf in the logs if deserialization is having any problems.

Is Lilith receiving events if you run your test app on your local machine with 127.0.0.1 as the IP?

I suspect that there is something going wrong with the Windows firewall or some other Windows security feature. I can't test this myself since I don't have access to any Windows machine.

from lilith.

Pesegato avatar Pesegato commented on May 30, 2024

Nope, I don't receive event on 127.0.0.1.
If I close lilith and then run the test I get an exception "Error writing to TCP:127.0.0.1:4560 socket not available".
If I run lilith and then run the test I don't get the expection (therefore the socket is receiving events), but on the gui and the error.log I see nothing, the event is silently discarded...

from lilith.

huxi avatar huxi commented on May 30, 2024

Hm... seriously strange...

This is what my config looks like in the sandbox:

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="debug">
	<appenders>
		<Console name="Console" target="SYSTEM_OUT">
			<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} --- %msg%n"/>
		</Console>
		<Socket name="Socket" host="localhost" port="4560" protocol="TCP">
			<SerializedLayout />
		</Socket>
	</appenders>
	<loggers>
		<root level="all">
			<appender-ref ref="Console"/>
			<appender-ref ref="Socket"/>
		</root>
	</loggers>
</configuration>

... but it's exactly the same as in the README.md.

You are using Lilith 8.1.x together with log4j2 2.8.1, right?

from lilith.

Pesegato avatar Pesegato commented on May 30, 2024

I'm using lilith 8.1.0, but on the client I have Java 6 and therefore I'm forced to use log4j2 2.3 (latest available for Java 6).

When I test localhost, I use Java 8 + log4j2 2.3

from lilith.

huxi avatar huxi commented on May 30, 2024

Current SNAPSHOT version of Lilith would write the following to the "Lilith events":

Exception (java.io.InvalidClassException: 'org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy; local class incompatible: stream classdesc serialVersionUID = -7139032940312647146, local class serialVersionUID = -8634075037355293699') while reading events. Adding eventWrapper with empty event and stopping...

Not writing anything to "Lilith events" was a bug.

I think your best bet would be to use SLF4J/Logback with my own appender. Be sure to use version 0.9.44 of the Lilith dependencies since those were the last that work with Java below 1.8. The latest Lilith version can still receive events from previous Lilith appender versions.

SLF4J 1.7.7 and Logback 1.1.2 and would be the matching dependencies guaranteed to be compatible.

There really isn't anything else I can do for you.
Java Serialization is a fragile (and dangerous) beast and there is no way I'm aware of to support more than one specific version of a class at the same time.

I'm currently working on support for more log4j2 layouts (JSON, YAML, XML) but that won't benefit you either since it will need at least log4j2 2.9. It would help with issues like that in the future, though.

from lilith.

Pesegato avatar Pesegato commented on May 30, 2024

I was already using your appender, but since I also needed syslog (which logback partially support... see https://stackoverflow.com/questions/30613319/logback-tcp-syslog-conforming-rfc-5424 )

...I was trying to switch from logback to log4j2.

So at the end of the day I guess that, thanks to slf4j, I'll use logback when I need lilith appender, and log4j2 when I need syslog... can't have both.
Thanks, anyway for your support.

from lilith.

huxi avatar huxi commented on May 30, 2024

You are welcome.

from lilith.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.