How to access logs from the MapTiler Server
This article addresses various ways on how to set up logging in the MapTiler Server running on Windows, macOS, Linux, or in Docker.
Prerequisites
The next steps will walk you through setting up logging in the MapTiler Server. We will assume that the software is installed, if you need assistance on how to install MapTiler Server, check out
- How to run MapTiler Server on macOS
- How to run MapTiler Server on Linux
- How to run MapTiler Server on Windows
Logging
Logging configuration is located in the Server section of the Settings or at the /admin/settings/server
endpoint. Here you can set custom logging levels, logging to the log file, and configure whether the API traffic should be logged as well.
Optionally you can set a custom log file path (not relative to the working directory) when registering maptiler-server
to run as a service. Details on how to do that can be found in these articles: How to run MapTiler Server on Linux, How to run MapTiler Server on macOS.
Docker
If you preferer running MapTiler Server in docker, you have two options for how to access the logs.
Docker logs
When starting the container in docker, e.g
docker run -p 3650:3650 -v $WORK_DIR:$WORK_DIR -d maptiler/server --workDir=$WORK_DIR
you should name the container by providing the --name
parameter. You can now access the logs by using the container name:
docker run -p 3650:3650 -v $WORK_DIR:$WORK_DIR -d --name maptiler-server maptiler/server --workDir=$WORK_DIR
docker logs maptiler-server
# follow the logs
docker logs -f maptiler-server
OR:
docker run -p 3650:3650 -v $WORK_DIR:$WORK_DIR -d maptiler/server --workDir=$WORK_DIR
docker ps
#CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
#89b792834a75 maptiler/server "app/maptiler-server…" 22 minutes ago Up 22 minutes 0.0.0.0:3650->3650/tcp, :::3650->3650/tcp romantic_wright
docker logs romantic_wright
Any logs produced by the container will be deleted when it is terminated. If you want your logs to persist after the container is shut down, configure logging to a file in the MaptTiler Server admin.
Logging to a file inside the docker container
If you want your logs to outlive the lifespan of the container, set up logging to a file in the admin section covered in the Logging section. If you have mapped a volume for the container, you will be able to access the log file even if the container has been shut down. The path for the file can be found in the Server section of the Settings.Conclusion
Conclusion
Logging allows for immense power and flexibility for the examination of the app’s behavior over time. There are various ways to set up logging in to the MapTiler Server, so don’t hesitate and configure it.
Useful links