Skip to content

Access log timestamps do not respect daylight savings time #11283

Open
@arpost

Description

@arpost

Describe the bug

I'm running aiohttp 3.10.11 in a linux docker container in the mountain daylight timezone, and the timestamp that aiohttp inserts into its access logs is in mountain standard time, which is confusing. I see this on Windows desktop and Linux server hosts, and the system time and timezone are correct in the containers as evidenced by running the date command and checking the time in python. The timestamp is in the message part of each log entry, which appears to be generated by aiohttp. For example (the time should be 13:50 and the offset should be -0600):

Image

To Reproduce

  1. Run aiohttp 3.10.11 and python 3.12.7 with default logging setup, for example, logging.basicConfig(level=logging.DEBUG), in a linux docker container.
  2. Observe that the access logs are in standard time not daylight, regardless of whether the user is in daylight savings or not.
  3. Run the date command inside the container to verify that the container's system time has the correct time and time zone, including daylight savings.

Expected behavior

aiohttp access logs should print in the system timezone, or perhaps UTC. If using the system timezone, it's confusing for the logs to use standard time when the system timezone is in daylight savings.

Logs/tracebacks

Should be 08/Jul/2025:13:58:46 -0600:
INFO:aiohttp.access:127.0.0.1 [08/Jul/2025:12:58:46 -0700] "GET /ping HTTP/1.1" 200 166 "-" "curl/7.88.1"

Python Version

$ python --version
Python 3.12.9

aiohttp Version

$ python -m pip show aiohttp
Name: aiohttp
Version: 3.10.11
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttp
Author: 
Author-email: 
License: Apache 2
Location: /usr/local/lib/python3.12/site-packages
Requires: aiohappyeyeballs, aiosignal, attrs, frozenlist, multidict, yarl
Required-by: aiohttp-remotes, aiohttp-swagger3, heaserver

multidict Version

$ python -m pip show multidict
Name: multidict
Version: 6.1.0
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache 2
Location: /usr/local/lib/python3.12/site-packages
Requires: 
Required-by: aiohttp, heaobject, yarl

propcache Version

$ python -m pip show propcache
Name: propcache
Version: 0.3.2
Summary: Accelerated property cache
Home-page: https://github.com/aio-libs/propcache
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache-2.0
Location: /usr/local/lib/python3.12/site-packages
Requires: 
Required-by: yarl

yarl Version

$ python -m pip show yarl
Name: yarl
Version: 1.18.3
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl
Author: Andrew Svetlov
Author-email: [email protected]
License: Apache-2.0
Location: /usr/local/lib/python3.12/site-packages
Requires: idna, multidict, propcache
Required-by: aio-pika, aiohttp, aiormq, heaobject

OS

Linux docker container (Debian Bookworm), with Linux (Alma Linux 9.5) and Windows (Windows 11 Enterprise 64-bit (10.0.22631)) hosts

Related component

Server

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions