@@ -123,9 +123,6 @@ class ExceptionSink:
123
123
# Set in methods on SignalHandler and exposed to the engine rust code.
124
124
_signal_sent : Optional [int ] = None
125
125
126
- # Whether the rust logger has been initialized so we can stop doing extra work in this class.
127
- _logging_initialized : bool = False
128
-
129
126
def __new__ (cls , * args , ** kwargs ):
130
127
raise TypeError ("Instances of {} are not allowed to be constructed!" .format (cls .__name__ ))
131
128
@@ -192,16 +189,6 @@ def reset_log_location(cls, new_log_location: str) -> None:
192
189
cls ._pid_specific_error_fileobj = pid_specific_error_stream
193
190
cls ._shared_error_fileobj = shared_error_stream
194
191
195
- @classmethod
196
- def set_logging_initialized (cls ):
197
- """Set the flag (to True) which indicates that the rust logger has been initialized.
198
-
199
- Class state:
200
- - Overwrites `cls._logging_initialized`.
201
- """
202
- # NB: mutate the class variables!
203
- cls ._logging_initialized = True
204
-
205
192
@classmethod
206
193
def exceptions_log_path (cls , for_pid = None , in_dir = None ):
207
194
"""Get the path to either the shared or pid-specific fatal errors log file."""
@@ -384,15 +371,13 @@ def log_exception(cls, exc_class=None, exc=None, tb=None, add_newline=False):
384
371
extra_err_msg = "Additional error logging unhandled exception {}: {}" .format (exc , e )
385
372
logger .error (extra_err_msg )
386
373
387
- # The rust logger implementation is used for most of pants's execution, but at import time,
388
- # we want to be able to see any stacktrace to know where the error is being raised.
389
- if cls ._logging_initialized :
390
- logger .exception (exc )
391
- else :
392
- exception_log_entry = cls ._format_unhandled_exception_log (
393
- exc , tb , add_newline , should_print_backtrace = True
394
- )
395
- logger .error (exception_log_entry )
374
+ # The rust logger implementation will have its own stacktrace, but at import time, we want
375
+ # to be able to see any stacktrace to know where the error is being raised, so we reproduce
376
+ # it here.
377
+ exception_log_entry = cls ._format_unhandled_exception_log (
378
+ exc , tb , add_newline , should_print_backtrace = True
379
+ )
380
+ logger .exception (exception_log_entry )
396
381
397
382
@classmethod
398
383
def _handle_signal_gracefully (cls , signum , signame , traceback_lines ):
0 commit comments