Log4j Docker SupportLog4j supports Docker by providing a Lookup to retrieve container information. Accessing DockerThe Log4j Docker support requires access to the Docker REST intrerface. In practical terms this means the application either needs access to unix:///var/run/docker.sock through a volume mount (not recommended), bind Docker to another host/port or unix socket. or use a proxy application to provide access. The Log4j Spring Cloud sample application uses a socat proxy to access Docker. Lookup AttributesLog4j Docker provides access to the following container attributes:
Attributes may be accessed by adding ${docker:containerId} to the configuration. Note that docker variables are only resolved once during logging initializaton so they shouldn’t be referenced with more than one ‘$’ character. RequirementsLog4j Docker requires Log4j Core, Log4j API and a minimum of Java 8. For more information, see Runtime Dependencies. |