08e6f633b5
### What changes were proposed in this pull request? This PR proposes to add a feature that logs container output for docker integration tests. With this change, if we run test with SBT, we will have like the following log in `unit-tests.log`. ``` ===== CONTAINER LOGS FOR container Id: 3360c98eb28337d8b217fb614e47bf49aafa18a6cb60ecadf3178aee0c663021 ===== 21/05/31 20:54:56.433 pool-1-thread-1 INFO PostgresIntegrationSuite: The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.utf8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. fixing permissions on existing directory /var/lib/postgresql/data ... ok creating subdirectories ... ok selecting dynamic shared memory implementation ... posix selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting default time zone ... UTC creating configuration files ... ok running bootstrap script ... ok sh: locale: not found 2021-05-31 11:54:49.892 UTC [29] WARNING: no usable system locales were found performing post-bootstrap initialization ... ok initdb: warning: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb. syncing data to disk ... ok Success. You can now start the database server using: pg_ctl -D /var/lib/postgresql/data -l logfile start waiting for server to start....2021-05-31 11:54:50.284 UTC [34] LOG: starting PostgreSQL 13.0 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.3.0) 9.3.0, 64-bit 2021-05-31 11:54:50.287 UTC [34] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2021-05-31 11:54:50.296 UTC [35] LOG: database system was shut down at 2021-05-31 11:54:50 UTC 2021-05-31 11:54:50.301 UTC [34] LOG: database system is ready to accept connections done server started /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/* waiting for server to shut down....2021-05-31 11:54:50.363 UTC [34] LOG: received fast shutdown request 2021-05-31 11:54:50.366 UTC [34] LOG: aborting any active transactions 2021-05-31 11:54:50.368 UTC [34] LOG: background worker "logical replication launcher" (PID 41) exited with exit code 1 2021-05-31 11:54:50.368 UTC [36] LOG: shutting down 2021-05-31 11:54:50.402 UTC [34] LOG: database system is shut down done server stopped PostgreSQL init process complete; ready for start up. 2021-05-31 11:54:50.510 UTC [1] LOG: starting PostgreSQL 13.0 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.3.0) 9.3.0, 64-bit 2021-05-31 11:54:50.510 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 2021-05-31 11:54:50.510 UTC [1] LOG: listening on IPv6 address "::", port 5432 2021-05-31 11:54:50.517 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2021-05-31 11:54:50.526 UTC [43] LOG: database system was shut down at 2021-05-31 11:54:50 UTC 2021-05-31 11:54:50.531 UTC [1] LOG: database system is ready to accept connections 2021-05-31 11:54:54.226 UTC [54] ERROR: relation "public.barcopy" does not exist at character 15 2021-05-31 11:54:54.226 UTC [54] STATEMENT: SELECT 1 FROM public.barcopy LIMIT 1 2021-05-31 11:54:54.610 UTC [59] ERROR: relation "public.barcopy2" does not exist at character 15 2021-05-31 11:54:54.610 UTC [59] STATEMENT: SELECT 1 FROM public.barcopy2 LIMIT 1 2021-05-31 11:54:54.934 UTC [63] ERROR: relation "shortfloat" does not exist at character 15 2021-05-31 11:54:54.934 UTC [63] STATEMENT: SELECT 1 FROM shortfloat LIMIT 1 2021-05-31 11:54:55.675 UTC [75] ERROR: relation "byte_to_smallint_test" does not exist at character 15 2021-05-31 11:54:55.675 UTC [75] STATEMENT: SELECT 1 FROM byte_to_smallint_test LIMIT 1 21/05/31 20:54:56.434 pool-1-thread-1 INFO PostgresIntegrationSuite: ===== END OF CONTAINER LOGS FOR container Id: 3360c98eb28337d8b217fb614e47bf49aafa18a6cb60ecadf3178aee0c663021 ===== ``` ### Why are the changes needed? If we have container logs, it's useful to debug especially for GA. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? I run docker integration tests and got logs. The example shown above is for `PostgresIntegrationSuite`. Closes #32715 from sarutak/log-docker-container. Authored-by: Kousuke Saruta <sarutak@oss.nttdata.com> Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org> |
||
---|---|---|
.. | ||
avro | ||
docker | ||
docker-integration-tests | ||
kafka-0-10 | ||
kafka-0-10-assembly | ||
kafka-0-10-sql | ||
kafka-0-10-token-provider | ||
kinesis-asl | ||
kinesis-asl-assembly | ||
spark-ganglia-lgpl |