Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

LogRecord.args not accessible

Open
#771 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #810 by @SarthakB11 — closed without merging

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

The report points to structlog.stdlib.ProcessorFormatter.format and shows a reproducer using ProcessorFormatter with logging.LogRecord.args. Start by reading that formatter and the related tests, then run the reproducer to confirm where args becomes empty. Done means the original arguments are accessible to the processor and a regression test covers the reported case.

Written by the indexing model from the issue text.

Description

waiting for feedback

If you inspect the stack the args are present in logging.Handler.format but not structlog.stdlib.ProcessorFormatter.format

processor, temp.py:15     <-- record.args = ()
format, stdlib.py:116     <-- record.args = ()
format, __init__.py:999   <-- record.args = ('a', 'b')
emit, __init__.py:1160
handle, __init__.py:1028
callHandlers, __init__.py:1762
handle, __init__.py:1700
_log, __init__.py:1684
info, __init__.py:1539
<module>, temp.py:26
import logging
import sys

import structlog
from structlog.types import EventDict
from structlog.typing import WrappedLogger

structlog.configure(processors=[structlog.stdlib.render_to_log_args_and_kwargs])  # processor shouldn't really matter here


def processor(logger: WrappedLogger, method_name: str, event_dict: EventDict) -> EventDict:
    log_record: logging.LogRecord | None = event_dict.get("_record")
    if log_record:
        print(f"{log_record.args=}")
    return event_dict["event"]


formatter = structlog.stdlib.ProcessorFormatter(fmt="%(message)s", processors=[processor])
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(formatter)
logging.basicConfig(level=logging.INFO, handlers=[handler])


logger = logging.getLogger()

logger.info("test a=%s b=%s", "a", "b")
Dominant language
Python
Stars
5k
Forks
302
Avg merge
17m
Merged PRs (30d)
4

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hynek/structlog

All issues in hynek/structlog

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.