@@ -141,16 +141,25 @@ def __init__(
141141 config_recv: The receiver to listen for configuration changes.
142142 log_format: Use the specified format string in logs.
143143 log_datefmt: Use the specified date/time format in logs.
144+
145+ Note:
146+ The `log_format` and `log_datefmt` parameters are used in a call to
147+ `logging.basicConfig()`. If logging has already been configured elsewhere
148+ in the application (through a previous `basicConfig()` call), then the format
149+ settings specified here will be ignored.
144150 """
145151 super ().__init__ ()
146152 self ._config_recv = config_recv
147- self ._format = log_format
148- self ._datefmt = log_datefmt
149153
150154 # Setup default configuration.
151155 # This ensures logging is configured even if actor fails to start or
152156 # if the configuration cannot be loaded.
153157 self ._current_config : LoggingConfig = LoggingConfig ()
158+
159+ logging .basicConfig (
160+ format = log_format ,
161+ datefmt = log_datefmt ,
162+ )
154163 self ._update_logging (self ._current_config )
155164
156165 async def _run (self ) -> None :
@@ -176,11 +185,10 @@ def _update_logging(self, config: LoggingConfig) -> None:
176185 logging .getLogger (logger_id ).setLevel (logging .NOTSET )
177186
178187 self ._current_config = config
179- logging .basicConfig (
180- format = self ._format ,
181- level = self ._current_config .root_logger .level ,
182- datefmt = self ._datefmt ,
188+ _logger .debug (
189+ "Setting root logger level to '%s'" , self ._current_config .root_logger .level
183190 )
191+ logging .getLogger ().setLevel (self ._current_config .root_logger .level )
184192
185193 # For each logger in the new config, set the log level
186194 for logger_id , logger_config in self ._current_config .loggers .items ():
0 commit comments