Skip to content

Commit

Permalink
Fix log (#10959)
Browse files Browse the repository at this point in the history
### Problem

A Python logger accessed with `logger = logging.Logger(__name__)` does not actually interact with the Rust logging code for some reason, causing logs emitted using this object to never be displayed anywhere. ``logger = logging.getLogger(__name__)`, which is the idiom we use everywhere in the pants codebase other than lint.py, works fine.

### Solution

Change the code to `logger = logging.getLogger(__name__)`.

Obviously it is confusing that one these two superficially-similar-seeming ways of interacting with the Python logging API simply fails to work, and that's probably worth looking into in the future.
  • Loading branch information
gshuflin authored Oct 14, 2020
1 parent a51f47b commit 485d183
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/python/pants/core/goals/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from pants.util.meta import frozen_after_init
from pants.util.strutil import strip_v2_chroot_path

logger = logging.Logger(__name__)
logger = logging.getLogger(__name__)


@dataclass(frozen=True)
Expand Down

0 comments on commit 485d183

Please sign in to comment.