简体   繁体   中英

read with java a log file outside of the deployed jar folder

My question is can I create a java microservice able to read all the logs of the others microservices?

The exact path of the logs of my 2 deployed microservices is this:

/app/ZZZ/dyn/clients/log/zzz_clients.log
/app/ZZZ/dyn/checkout/log/zzz_checkout.log

Is it possible to create a new spring boot logging microService which will be deployed to this exact path:

/app/ZZZ/dyn/logging/

able to read to logs file of the others 2 microservices?

To be clear the folders:

/app/ZZZ/dyn/clients/

/app/ZZZ/dyn/checkout/

/app/ZZZ/dyn/logging/

are the one containing the following folders/file:

/app/ZZZ/dyn/nameOfMicroservice
|_ BOOT-INF
|_ ZZZ_nameOfMicroservice.jar
|_ META-INF
|_ org

where nameOfMicroservice is the: clients , checkout , logging

I know how to read a file contained inside the project folder but how can I read files external to my logging service jar is deployed?

thanks

It is recommended implementing a centralized log storage and creating a separate logging service that receives log entries from different microservices and saves them in centralized storage.

Having centralized log storage simplifies logging, log retrieval, analytics, investigation, management and coordination of microservices log data.

Microservices logging best practices every team should know

What makes an effective microservices logging strategy?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM