Home > Enterprise >  Spring boot read logs
Spring boot read logs

Time:01-08

I have a Java11 Spring Boot application, and an old Java8 Struts1 application.

Is it possible for the Struts1 application to read the console output logs generated by the Spring Boot application?

(I think the answer is it is not possible, but hoping there may be a way)

CodePudding user response:

Instead, your Spring Boot application may use a FileAppender to print to a file.log and your Struts application may read from that file.log.

However, this looks like a quick and dirty solution. Actually, the standard way to allows communication between Java applications is exchanging messages with JMS API.

CodePudding user response:

when a logger object prints to console, it is writing to System.out.

System.out is a static object of class PrintStream, which is an OutputStream. And you cannot read from an OutputStream.

CodePudding user response:

I thinks you should use something to keep logs that generated by struct and then read them with spring, if you want to read them in real time apache Kafka is my suggestion. stream logs into Kafka with struct then read them in your spring application

  •  Tags:  
  • Related