I am using bazel
to build and run tests for my project.
I want to get more insight into how my tests are running. I want to be able to see the output captured by the logger in my java app.
I have tried adding -s
parameter to start my tests, like so: bazel test -s //myproject:integration-test
and it gives me more info regarding how the test is invoked:
remote: Resolving deltas: 100% (101/101), completed with 18 local objects.
To github.com:work/work.git
$ bazel test -s //myproject:integration-tests
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
/nix/store/qsmyc0p2z1z3m06ch37hz49m0hz2c270-bazel-rc
INFO: Invocation ID: 2d17fb35-c72b-4152-bf14-2805027c6c01
INFO: Analyzed target //myproject:integration-tests (0 packages loaded, 0 targets configured).
INFO: Found 1 test target...
SUBCOMMAND: # //myproject:integration-tests [action 'Testing //myproject:integration-tests', configuration: cd8c76baa0169ef7c8b826ed0feb93200dd87a70639fd99286b8801aa9226239]
(cd /private/var/tmp/_bazel_antkong/cf188c7bd288685357ff03fcbb494066/execroot/com_work_work && \
exec env - \
CI='' \
DISPLAY=:1 \
EXPERIMENTAL_SPLIT_XML_GENERATION=1 \
FLAVOR=local \
JAVA_RUNFILES=bazel-out/darwin-fastbuild/bin/myproject/integration-tests.runfiles \
PATH=/nix/store/6ajpp69s5lf5krrdzy3mw1fs22vg1fqq-user-environment/bin \
PYTHON_RUNFILES=bazel-out/darwin-fastbuild/bin/myproject/integration-tests.runfiles \
RUNFILES_DIR=bazel-out/darwin-fastbuild/bin/myproject/integration-tests.runfiles \
RUN_UNDER_RUNFILES=1 \
TEST_BINARY=myproject/integration-tests \
TEST_INFRASTRUCTURE_FAILURE_FILE=bazel-out/darwin-fastbuild/testlogs/myproject/integration-tests/test.infrastructure_failure \
TEST_LOGSPLITTER_OUTPUT_FILE=bazel-out/darwin-fastbuild/testlogs/myproject/integration-tests/test.raw_splitlogs/test.splitlogs \
TEST_PREMATURE_EXIT_FILE=bazel-out/darwin-fastbuild/testlogs/myproject/integration-tests/test.exited_prematurely \
TEST_SIZE=large \
TEST_SRCDIR=bazel-out/darwin-fastbuild/bin/myproject/integration-tests.runfiles \
TEST_TARGET=//myproject:integration-tests \
TEST_TIMEOUT=900 \
TEST_TMPDIR=_tmp/73bce5ef685ff9d5d824b9a0b736db87 \
TEST_UNDECLARED_OUTPUTS_ANNOTATIONS=bazel-out/darwin-fastbuild/testlogs/myproject/integration-tests/test.outputs_manifest/ANNOTATIONS \
TEST_UNDECLARED_OUTPUTS_ANNOTATIONS_DIR=bazel-out/darwin-fastbuild/testlogs/myproject/integration-tests/test.outputs_manifest \
TEST_UNDECLARED_OUTPUTS_DIR=bazel-out/darwin-fastbuild/testlogs/myproject/integration-tests/test.outputs \
TEST_UNDECLARED_OUTPUTS_MANIFEST=bazel-out/darwin-fastbuild/testlogs/myproject/integration-tests/test.outputs_manifest/MANIFEST \
TEST_UNDECLARED_OUTPUTS_ZIP=bazel-out/darwin-fastbuild/testlogs/myproject/integration-tests/test.outputs/outputs.zip \
TEST_UNUSED_RUNFILES_LOG_FILE=bazel-out/darwin-fastbuild/testlogs/myproject/integration-tests/test.unused_runfiles_log \
TEST_WARNINGS_OUTPUT_FILE=bazel-out/darwin-fastbuild/testlogs/myproject/integration-tests/test.warnings \
TEST_WORKSPACE=com_work_work \
TZ=UTC \
XAUTHORITY=/dev/null \
XML_OUTPUT_FILE=bazel-out/darwin-fastbuild/testlogs/myproject/integration-tests/test.xml \
external/bazel_tools/tools/test/test-setup.sh myproject/integration-tests)
Aspect @mypy_integration//:mypy.bzl%mypy_aspect of //myproject:integration-tests up-to-date (nothing to build)
INFO: Elapsed time: 6.692s, Critical Path: 5.34s
INFO: 1 process: 1 processwrapper-sandbox.
INFO: Build completed successfully, 2 total actions
//myproject:integration-tests PASSED in 5.1s
Executed 1 out of 1 test: 1 test passes.
INFO: Build completed successfully, 2 total actions
However it is actually not what I am after. I want to able to see the output logged via calls to a logger in java code:
private static final Logger logger = LoggerFactory.getLogger(
MyProject.class);
...
logger.info('It is executed')
Is there any switch I can use so bazel can turn on the logging?