Repository: litestar-org/litestar

Issue:
Bug: logging AttributeError: 'str' object has no attribute 'handle'
### Description

I get this error using a slightly modified mvce that comes from the docs (just changed the handler to be async)

```
❯ uvicorn l:app
INFO:     Started server process [269081]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     127.0.0.1:35226 - "GET / HTTP/1.1" 200 OK
Exception in thread Thread-1 (_monitor):
Traceback (most recent call last):
  File "/home/lotso/.asdf/installs/python/3.11.6/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/home/lotso/.asdf/installs/python/3.11.6/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/home/lotso/.asdf/installs/python/3.11.6/lib/python3.11/logging/handlers.py", line 1584, in _monitor
    self.handle(record)
  File "/home/lotso/.asdf/installs/python/3.11.6/lib/python3.11/logging/handlers.py", line 1565, in handle
    handler.handle(record)
    ^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'handle'
INFO:     127.0.0.1:35226 - "GET / HTTP/1.1" 200 OK
```


### URL to code causing the issue

_No response_

### MCVE

```python
from litestar import Litestar, Request, get
from litestar.logging import LoggingConfig


@get("/")
async def my_router_handler(request: Request) -> None:
    request.logger.info("inside a request")
    return None


logging_config = LoggingConfig(
    loggers={
        "my_app": {
            "level": "INFO",
            "handlers": ["queue_listener"],
        }
    }
)

app = Litestar(route_handlers=[my_router_handler], logging_config=logging_config)
```


### Steps to reproduce

```bash
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
```


### Screenshots

```bash
"![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"
```


### Logs

_No response_

### Litestar Version

`  • Installing litestar (2.2.1 7c3d24f)`

### Platform

- [X] Linux
- [ ] Mac
- [ ] Windows
- [ ] Other (Please specify in the description above)

<!-- POLAR PLEDGE BADGE START -->
---
> [!NOTE]  
> While we are open for sponsoring on [GitHub Sponsors](https://github.com/sponsors/litestar-org/) and 
> [OpenCollective](https://opencollective.com/litestar), we also utilize [Polar.sh](https://polar.sh/) to engage in pledge-based sponsorship.
>
> Check out all issues funded or available for funding [on our Polar.sh Litestar dashboard](https://polar.sh/litestar-org)
> * If you would like to see an issue prioritized, make a pledge towards it!
> * We receive the pledge once the issue is completed & verified
> * This, along with engagement in the community, helps us know which features are a priority to our users.

<a href="https://polar.sh/litestar-org/litestar/issues/2477">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/litestar-org/litestar/issues/2477/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/litestar-org/litestar/issues/2477/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->



Discussion:
2.2.1 nor 2.2.0  exhibit the traceback, there might have been a regression recently
What py version?
it's 3.11.6
I also have the bug on same litestar git version but without using LoggingConfig
I think this is the culprit:
https://github.com/litestar-org/litestar/blob/7c3d24f9b70731df372b29bff9eb5cf359055b3a/litestar/logging/config.py#L43

however that just defies my comprehension :)
I think that might just need to be added under an `if >= 3.12.0` guard if that is the case. There have been changes to the way queue handlers/listeners are configured in 3.12 (https://docs.python.org/3/library/logging.config.html#configuring-queuehandler-and-queuelistener).

The thing is, that change hasn't made it into a release yet - you are installing from main?

Resolving patch:
diff --git a/litestar/logging/config.py b/litestar/logging/config.py
--- a/litestar/logging/config.py
+++ b/litestar/logging/config.py
@@ -1,5 +1,6 @@
 from __future__ import annotations
 
+import sys
 from abc import ABC, abstractmethod
 from dataclasses import asdict, dataclass, field
 from importlib.util import find_spec
@@ -40,10 +41,13 @@
         "class": "litestar.logging.standard.QueueListenerHandler",
         "level": "DEBUG",
         "formatter": "standard",
-        "handlers": ["console"],
     },
 }
 
+if sys.version_info >= (3, 12, 0):
+    default_handlers["queue_listener"]["handlers"] = ["console"]
+
+
 default_picologging_handlers: dict[str, dict[str, Any]] = {
     "console": {
         "class": "picologging.StreamHandler",


Test patch: