i have a java application. I export my project as a .war file, build a docker container and run it.
The structure is the following. For the logging i use the library from java.
import java.util.logging.Logger;
In my application i define my variable:
private static final Logger logger = Logger.getLogger(BusController.class.getName());
And for the output i use for example:
logger.warning("User "+XYZ+" not found!");
When i start my dockerfile, i mount an extra volume for the logs.
REGISTRY=xxxxx.net
VERSION=latest
IMAGE=busMicroservice
SERVICE=busmicroservice
LOCAL_DATA_PATH=/opt/docker-busmicroservice/data
docker run -p xxxx:xxxxx -d -v $LOCAL_DATA_PATH:/logs --name $SERVICE --hostname $SERVICE $REGISTRY/$IMAGE:$VERSION
After the docker container has started successfully , i can check my volume with
docker inspect busmicroservice
and can see, that my volume is included. But what do i have to do now, that the logs will be saved in my folder "/logs"? What do i have to implement in my java application?
Thank you in advance!
--------- EDIT ----------
I have a second thread now for an additional question: How to save logfiles into a docker volume
/logs. I don't really understand your question.