Reading Container Logs

When all the desired containers are up and running, it is best practice to check the logs for all the running services.

Logs for all the started and exited containers are available at the path you have mentioned for the HOST_LOG_ROOT_LOCATION_DIR_PATH variable in the .env file. So all the logs are preserved on your host machine.

Procedure

  • When you are starting multiple containers of the same service, for example, when you are scaling the OMS, OPE, or AOPD service, use the system generated prefix ${sys:uuid} to fileName and filePattern properties of the RollingFile element of the Log4j XML file of the service you are scaling.

    For example, when you are trying to scale the OMS server service, open OMSServerLog4j.xml and locate the element RollingFile and add the prefix ${sys:uuid} to the fileName and filePattern properties.

    The changed properties will look like this:

     <RollingFile name="LocalLogFileAppender"
    fileName="logs/${sys:uuid}omsServer-local.log"
    filePattern="logs/${sys:uuid}omsServer-local-%i.log">

    This ensures that scaling multiple times does not overwrite the log files as the file names are appended with a random generated text. The Docker daemon also logs all the activities of the container right from the moment you start it. For more information, see the Docker documentation on Docker logs.