1

I have the following log4j.properties file in a docker container:

log4j.rootLogger=WARN,CONSOLE
log4j.logger.com.xxx.mypackage=DEBUG

# Console appender
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d %-5p [%c] %m%n

So, I'm logging in the console. Can this configuration consume disk space in linux? Because I have no space left in my device and the space results free after the command:

docker-compose down 
Dan
  • 3,647
  • 5
  • 20
  • 26
pakolela
  • 19
  • 4
  • Typing "docker logs directory" in my [favorite search engine](https://www.qwant.com/?q=docker+logs+directory) gives as top result => https://sematext.com/blog/docker-logs-location/. This link seems to fully answer your question and confirm your experience (which pretty much answered the question by itself). Of course you can have a look at all the other results. So the answer is: Yes, since what is sent to the container's default stdout/stderr is stored on the host's disk by default while it is running. – Zeitounator May 28 '22 at 10:07

1 Answers1

0

Yes, stdout and stderr in containers are captured as logs in docker. By default, they are stored in json without limits beside the other container filesystem changes and metadata. Those filesystem changes and logs are removed when the container is deleted. And as long as the container exists, they can be viewed with docker logs for a given container.

To limit the size of these logs, see this answer that describes the engine defaults and container specific overrides for the logs.

BMitch
  • 231,797
  • 42
  • 475
  • 450