Skip to content

Commit 6b01f18

Browse files
committed
Use explicit logger names to fix logging when modules run as __main__
getLogger(__name__) resolves to 'ogc.bblocks.*' when imported but to '__main__' when run directly, which falls outside the 'ogc.bblocks' hierarchy configured by setup_logging and produces no output.
1 parent 5ddf8df commit 6b01f18

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

ogc/bblocks/entrypoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135

136136
args = parser.parse_args()
137137
setup_logging(args.log_level, args.log_file)
138-
logger = logging.getLogger(__name__)
138+
logger = logging.getLogger('ogc.bblocks.entrypoint')
139139

140140
fail_on_error = args.fail_on_error in ('true', 'on', 'yes', '1')
141141
clean = args.clean in ('true', 'on', 'yes', '1')

ogc/bblocks/generate_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sys
77
from os.path import relpath
88

9-
logger = logging.getLogger(__name__)
9+
logger = logging.getLogger('ogc.bblocks.generate_docs')
1010
from pathlib import Path
1111
from argparse import ArgumentParser
1212
from typing import Sequence

ogc/bblocks/postprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from ogc.bblocks.log import log_indent
1818

19-
logger = logging.getLogger(__name__)
19+
logger = logging.getLogger('ogc.bblocks.postprocess')
2020

2121
from ogc.na.exceptions import ContextLoadError
2222
from ogc.na.util import is_url, dump_yaml

0 commit comments

Comments
 (0)