Setup logging before plugins are loaded.

Review Request #1820 - Created Feb. 24, 2015 and submitted

Information
John Sirois
pants
jsirois/logging/early_setup
1158
52306b8...
Reviewers
pants-reviews
benjyw, zundel
This lifts logging options to the bootstrap stage in order to be able
to configure logging before plugins are loaded.  The logging setup is
lifted out from GoalRunner to a top-level function in the logging
package and tests are added for logging configuration.

Additionally, bootstrap option parsing is fixed to handle short flags
since logging uses a few of these.

 src/python/pants/bin/BUILD                                  | 26 ++--------------
 src/python/pants/bin/goal_runner.py                         | 55 +++++----------------------------
 src/python/pants/logging/BUILD                              | 10 ++++++
 src/python/pants/logging/__init__.py                        |  0
 src/python/pants/logging/setup.py                           | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/python/pants/option/global_options.py                   |  6 ----
 src/python/pants/option/options_bootstrapper.py             | 24 ++++++++++++++-
 tests/python/pants_test/BUILD                               |  1 +
 tests/python/pants_test/logging/BUILD                       | 12 ++++++++
 tests/python/pants_test/logging/__init__.py                 |  0
 tests/python/pants_test/logging/test_setup.py               | 61 +++++++++++++++++++++++++++++++++++++
 tests/python/pants_test/option/test_options_bootstrapper.py | 19 +++++++++++-
 12 files changed, 218 insertions(+), 78 deletions(-)

New tests go green:

$ PANTS_DEV=1 ./pants test tests/python/pants_test/{option,logging}
...
23:17:56 00:01   [test]
23:17:56 00:01     [run_prep_command]
23:17:56 00:01     [test]
23:17:56 00:01     [pytest]
23:17:56 00:01       [run]
                     ============== test session starts ===============
                     platform linux2 -- Python 2.7.8 -- py-1.4.26 -- pytest-2.6.4
                     plugins: cov, timeout
                     collected 30 items 

                     tests/python/pants_test/option/test_arg_splitter.py ..
                     tests/python/pants_test/option/test_options.py .............
                     tests/python/pants_test/option/test_option_value_container.py ......
                     tests/python/pants_test/option/test_options_bootstrapper.py ....
                     tests/python/pants_test/option/test_custom_types.py ..
                     tests/python/pants_test/option/test_help_formatter.py .
                     tests/python/pants_test/logging/test_setup.py ..

                     =========== 30 passed in 0.35 seconds ============

23:17:56 00:01     [junit]
23:17:56 00:01     [specs]
               SUCCESS

Manual testing using combinations of -ldebug, -d/tmp/logs and --quiet looks good.

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/52302714

Issues

  • 0
  • 3
  • 0
  • 3
Description From Last Updated
John Sirois
John Sirois
Eric Ayers
Benjy Weinberger
Stu Hood
John Sirois
Eric Ayers
John Sirois
John Sirois
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...