0

Let's say am running a Spring Boot app via CLI using java command java -Dserver.port=5743 -jar somejar.jar and I want the logs to be printed within the cli and also copy into files.

So far I could do only one at a time either on CLI or file

0

2 Answers 2

1

You can use the tee utility, it copies standard input to standard output, making a copy in zero or more files.

java -Dserver.port=5742 -jar somejar.jar | tee output.file

Sign up to request clarification or add additional context in comments.

Comments

0

I'd suggest to use Log4j with multiple appenders in your application.

2 Comments

Thanks Tony Stark. It is definitely a helpful tip. But I wanted generic solution that supports other frameworks and languages.
@kivin6866: You can use Log4j with every other framework (not only Spring Boot) and there are similar implementations in other languages.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.