---
source: crates/ruff_linter/src/rules/flake8_logging/mod.rs
---
LOG004_0.py:13:1: LOG004 [*] `.exception()` call outside exception handlers
   |
11 | ### Errors
12 |
13 | logging.exception("")
   | ^^^^^^^^^^^^^^^^^^^^^ LOG004
14 | logger.exception("")
15 | exc("")
   |
   = help: Replace with `.error()`

ℹ Unsafe fix
10 10 | 
11 11 | ### Errors
12 12 | 
13    |-logging.exception("")
   13 |+logging.error("")
14 14 | logger.exception("")
15 15 | exc("")
16 16 | 

LOG004_0.py:14:1: LOG004 [*] `.exception()` call outside exception handlers
   |
13 | logging.exception("")
14 | logger.exception("")
   | ^^^^^^^^^^^^^^^^^^^^ LOG004
15 | exc("")
   |
   = help: Replace with `.error()`

ℹ Unsafe fix
11 11 | ### Errors
12 12 | 
13 13 | logging.exception("")
14    |-logger.exception("")
   14 |+logger.error("")
15 15 | exc("")
16 16 | 
17 17 | 

LOG004_0.py:15:1: LOG004 `.exception()` call outside exception handlers
   |
13 | logging.exception("")
14 | logger.exception("")
15 | exc("")
   | ^^^^^^^ LOG004
   |
   = help: Replace with `.error()`

LOG004_0.py:19:5: LOG004 [*] `.exception()` call outside exception handlers
   |
18 | def _():
19 |     logging.exception("")
   |     ^^^^^^^^^^^^^^^^^^^^^ LOG004
20 |     logger.exception("")
21 |     exc("")
   |
   = help: Replace with `.error()`

ℹ Unsafe fix
16 16 | 
17 17 | 
18 18 | def _():
19    |-    logging.exception("")
   19 |+    logging.error("")
20 20 |     logger.exception("")
21 21 |     exc("")
22 22 | 

LOG004_0.py:20:5: LOG004 [*] `.exception()` call outside exception handlers
   |
18 | def _():
19 |     logging.exception("")
20 |     logger.exception("")
   |     ^^^^^^^^^^^^^^^^^^^^ LOG004
21 |     exc("")
   |
   = help: Replace with `.error()`

ℹ Unsafe fix
17 17 | 
18 18 | def _():
19 19 |     logging.exception("")
20    |-    logger.exception("")
   20 |+    logger.error("")
21 21 |     exc("")
22 22 | 
23 23 | 

LOG004_0.py:21:5: LOG004 `.exception()` call outside exception handlers
   |
19 |     logging.exception("")
20 |     logger.exception("")
21 |     exc("")
   |     ^^^^^^^ LOG004
   |
   = help: Replace with `.error()`

LOG004_0.py:28:9: LOG004 [*] `.exception()` call outside exception handlers
   |
26 | except ...:
27 |     def _():
28 |         logging.exception("")
   |         ^^^^^^^^^^^^^^^^^^^^^ LOG004
29 |         logger.exception("")
30 |         exc("")
   |
   = help: Replace with `.error()`

ℹ Unsafe fix
25 25 |     ...
26 26 | except ...:
27 27 |     def _():
28    |-        logging.exception("")
   28 |+        logging.error("")
29 29 |         logger.exception("")
30 30 |         exc("")
31 31 | 

LOG004_0.py:29:9: LOG004 [*] `.exception()` call outside exception handlers
   |
27 |     def _():
28 |         logging.exception("")
29 |         logger.exception("")
   |         ^^^^^^^^^^^^^^^^^^^^ LOG004
30 |         exc("")
   |
   = help: Replace with `.error()`

ℹ Unsafe fix
26 26 | except ...:
27 27 |     def _():
28 28 |         logging.exception("")
29    |-        logger.exception("")
   29 |+        logger.error("")
30 30 |         exc("")
31 31 | 
32 32 | 

LOG004_0.py:30:9: LOG004 `.exception()` call outside exception handlers
   |
28 |         logging.exception("")
29 |         logger.exception("")
30 |         exc("")
   |         ^^^^^^^ LOG004
   |
   = help: Replace with `.error()`
