Where to find local AEM logs inside a Docker Container ?

abhifoyou

06-04-2020

hi Team,

 

As my organization uses a docker container to run local AEM instance, I am NOT able to find log files or even crx/quickstart folder to play with.

I understand this question is more specific to AEM with docker, but has anyone in this forum happen to find the AEM log files for the local instance ? Otherwise, how we can debug our code while AEM running inside docker ?

 

I have been asked to use the below command to tail the logs, but I want to know the actual location of the AEM logs folder. 

 

docker exec -it aem tail --lines 0 -f ./crx-quickstart/logs/error.log

 

Thanks !

Accepted Solutions (1)

Accepted Solutions (1)

Theo_Pendle

MVP

06-04-2020

Hi, 

Of course this will completely depend on how the Docker image is set up.. but here are some pointers:

  1. Check the docker-compose.yaml or docker command which launched the container to see if a drive was mounted in a specific way or if a volume is used to store the logs.
  2. Even if you can't find the log files there are a couple of ways to see the logs:
    1. You can check the contents of all log files by navigating to /system/console/slinglog in your browser. You can even download a zip containing all the logs.
    2. If you want to see the logs in real-time, head over to CRX DE and open the Console tab (where the node properties are) un-check the Disable console button and you will get a tail of the error.log:
      Selection_096.png
  3. You run a remote debug listener on AEM using your favorite IDE (I use IntelliJ). To do so, just make sure that your AEM instance is running a debug port (30303 for example) and that the port is exposed by the container.

PS: I see you are looking for ./crx-quickstart inside the container, but a typical place to find AEM and the crx-quickstart folder is at /opt/aem/[author|publisher]/crx-quickstart
 

Answers (1)

Answers (1)

Briankasingli

MVP

06-04-2020

Hi, I've been working on local AEM projects with Docker for some time. Here's how you can achieve tailing logs for your running local docker AEM instance. 

Assuming that your system supports UNIX commands, and your local docker instances are running, here goes:

  1. docker ps - this will list all running instances along with the container ID; copy the container ID.
  2. docker exec -it <containerID> bash - this will execute an interactive bash shell on the container.
  3. tail -f .../crx-quickstart/logs/error.log - tail -f command will wait for new strings in the file and show these strings dynamically. 

Docker documentation can be found here: https://docs.docker.com/engine/reference/commandline/exec/

I hope this helps.