Nils
Nils

Reputation: 43

Is it still possible to use log4j remote logging?

I found some quite old examples online that allow use the org.apache.logging.log4j.core.net.server.TcpSocketServer for remote logging (see https://github.com/piruin/log4j2-socket-server ). Unfortunately, it appears the class got removed or moved in updated versions.

How can I archive remote logging with log4j these days? Any tutorials available?

Upvotes: 0

Views: 1082

Answers (1)

Parsifal
Parsifal

Reputation: 4486

On the client side, Log4J gives you multiple options:

On the server side, you won't find anything in the Log4J library, but there are plenty of options:

  • For "quick and dirty", you can use NetCat:

    nc -l 1234 > foo.log
    
  • Syslog is available on any Linux system; you can set up a central server and write logs to files. Personally, I find it more trouble than it's worth.

  • A better solution, if you want to run it yourself, is fluentd. This will require some configuration, but gives you a lot of flexibility and future expansion.

  • There are also plenty of 3rd-party services, such as Loggly or DataDog, which will accept your log messages and give you a search engine interface to view them.

Upvotes: 2

Related Questions