|
21 | 21 | from imap_l3_processing.swe.swe_processor import SweProcessor |
22 | 22 | from imap_l3_processing.ultra.l3.ultra_processor import UltraProcessor |
23 | 23 |
|
| 24 | +logger = logging.getLogger(__name__) |
24 | 25 |
|
25 | 26 | def _parse_cli_arguments(): |
26 | 27 | parser = argparse.ArgumentParser() |
@@ -111,30 +112,11 @@ def _furnish_spice_kernels(processing_input_collection): |
111 | 112 |
|
112 | 113 | if __name__ == '__main__': |
113 | 114 | with TemporaryDirectory() as dir: |
114 | | - args = _parse_cli_arguments() |
115 | | - logger = logging.getLogger('application') |
116 | | - logger.setLevel(logging.INFO) |
117 | | - |
118 | | - log_path = Path( |
119 | | - dir) / f"imap_{args.instrument}_{args.data_level}_log-{datetime.now().strftime('%Y-%m-%d-%H%M%S-%f')}_{args.start_date}_v001.cdf" |
120 | | - fh = logging.FileHandler(str(log_path)) |
121 | | - |
122 | | - fh.setLevel(logging.INFO) |
123 | | - formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') |
124 | | - fh.setFormatter(formatter) |
125 | | - logger.addHandler(fh) |
| 115 | + logging.basicConfig(force=True, level=logging.INFO, |
| 116 | + format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') |
126 | 117 |
|
127 | 118 | try: |
128 | 119 | imap_l3_processor() |
129 | 120 | except Exception as e: |
130 | | - logger.info("Unhandled Exception:", exc_info=e) |
131 | | - print("caught exception") |
132 | | - traceback.print_exc() |
133 | | - logging.shutdown() |
| 121 | + logger.error("Unhandled Exception:") |
134 | 122 | raise e |
135 | | - finally: |
136 | | - should_upload_log = False |
137 | | - if should_upload_log and os.path.exists(log_path) and os.path.getsize(log_path) > 0: |
138 | | - imap_data_access.upload(log_path) |
139 | | - |
140 | | - logging.shutdown() |
0 commit comments