Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'picologging' has no attribute 'PlaceHolder' #67

Closed
cofin opened this issue Sep 8, 2022 · 0 comments · Fixed by #70
Closed

AttributeError: module 'picologging' has no attribute 'PlaceHolder' #67

cofin opened this issue Sep 8, 2022 · 0 comments · Fixed by #70

Comments

@cofin
Copy link

cofin commented Sep 8, 2022

I'm using picologging on a project with uvicorn and I'm running into the following exception. Should this class exist in the picologging library? I can't find the actual implementation for this.

Here is the line referenced in the error:

if not isinstance(logger, picologging.PlaceHolder):

and here is a chunk of the traceback:

Launching API Server with Uvicorn
[09/08/22 12:21:12] ERROR    Traceback (most recent call last):                                                                                                                                                                                                                                                            on.py:121
                               File "/Users/codyfincher/Code/OPDBA/oracle-database-assessment/master/.venv/lib/python3.10/site-packages/starlette/routing.py", line 645, in lifespan                                                                                                                                                
                                 async with self.lifespan_context(app):                                                                                                                                                                                                                                                             
                               File "/Users/codyfincher/Code/OPDBA/oracle-database-assessment/master/.venv/lib/python3.10/site-packages/starlette/routing.py", line 540, in __aenter__                                                                                                                                              
                                 await self._router.startup()                                                                                                                                                                                                                                                                       
                               File "/Users/codyfincher/Code/OPDBA/oracle-database-assessment/master/.venv/lib/python3.10/site-packages/starlite/asgi.py", line 236, in startup                                                                                                                                                     
                                 await self._call_lifespan_handler(handler)                                                                                                                                                                                                                                                         
                               File "/Users/codyfincher/Code/OPDBA/oracle-database-assessment/master/.venv/lib/python3.10/site-packages/starlite/asgi.py", line 220, in _call_lifespan_handler                                                                                                                                      
                                 value = handler()  # type:ignore                                                                                                                                                                                                                                                                   
                               File "/Users/codyfincher/Code/OPDBA/oracle-database-assessment/master/.venv/lib/python3.10/site-packages/starlite/config/logging.py", line 60, in configure                                                                                                                                          
                                 picologging_config.dictConfig(self.dict(exclude_none=True))                                                                                                                                                                                                                                        
                               File "/Users/codyfincher/Code/OPDBA/oracle-database-assessment/master/.venv/lib/python3.10/site-packages/picologging/config.py", line 332, in dictConfig                                                                                                                                             
                                 dictConfigClass(config).configure()                                                                                                                                                                                                                                                                
                               File "/Users/codyfincher/Code/OPDBA/oracle-database-assessment/master/.venv/lib/python3.10/site-packages/picologging/config.py", line 156, in configure                                                                                                                                              
                                 _handle_existing_loggers(existing, child_loggers, disable_existing)                                                                                                                                                                                                                                
                               File "/Users/codyfincher/Code/OPDBA/oracle-database-assessment/master/.venv/lib/python3.10/site-packages/picologging/config.py", line 46, in _handle_existing_loggers                                                                                                                                
                                 if not isinstance(logger, picologging.PlaceHolder):                                                                                                                                                                                                                                                
                             AttributeError: module 'picologging' has no attribute 'PlaceHolder'                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                                                                    
[09/08/22 12:21:12] ERROR    Application startup failed. Exiting.  

Here is more details:

│ /Users/codyfincher/Code/OPDBA/oracle-database-assessment/master/.venv/lib/python3.10/site-packag │
│ es/picologging/config.py:156 in configure                                                        │
│                                                                                                  │
│   153 │   │   # and by disabling them, you stop them doing any logging.                          │
│   154 │   │   # However, don't disable children of named loggers, as that's                      │
│   155 │   │   # probably not what was intended by the user.                                      │
│ ❱ 156 │   │   _handle_existing_loggers(existing, child_loggers, disable_existing)                │
│   157 │   │                                                                                      │
│   158 │   │   # And finally, do the root logger                                                  │
│   159 │   │   root = config.get("root", None)                                                    │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │    child_loggers = ['starlite_bedrock.starlite.exceptions']                                  │ │
│ │           config = {                                                                         │ │
│ │                    │   'version': 1,                                                         │ │
│ │                    │   'filters': {                                                          │ │
│ │                    │   │   'health_filter':                                                  │ │
│ │                    <starlite_bedrock.starlite.logging.AccessLogFilter object at 0x10cbe83d0> │ │
│ │                    │   },                                                                    │ │
│ │                    │   'propagate': True,                                                    │ │
│ │                    │   'formatters': {'standard': <Formatter: fmt='%(message)s'>},           │ │
│ │                    │   'handlers': {                                                         │ │
│ │                    │   │   'console':                                                        │ │
│ │                    <starlite_bedrock.starlite.logging.RichPicologgingHandler object at       │ │
│ │                    0x10bec03c0>,                                                             │ │
│ │                    │   │   'queue_listener':                                                 │ │
│ │                    <starlite.logging.picologging.QueueListenerHandler object at 0x10cbb4140> │ │
│ │                    │   },                                                                    │ │
│ │                    │   'loggers': {                                                          │ │
│ │                    │   │   'starlite_bedrock': {'propagate': True},                          │ │
│ │                    │   │   'uvicorn.access': {                                               │ │
│ │                    │   │   │   'propagate': True,                                            │ │
│ │                    │   │   │   'filters': ['health_filter']                                  │ │
│ │                    │   │   },                                                                │ │
│ │                    │   │   'uvicorn.error': {'propagate': True},                             │ │
│ │                    │   │   'gunicorn.access': {                                              │ │
│ │                    │   │   │   'propagate': True,                                            │ │
│ │                    │   │   │   'filters': ['health_filter']                                  │ │
│ │                    │   │   },                                                                │ │
│ │                    │   │   'gunicorn.error': {'propagate': True},                            │ │
│ │                    │   │   'sqlalchemy': {'propagate': True},                                │ │
│ │                    │   │   'starlite': {'level': 'WARNING', 'propagate': True},              │ │
│ │                    │   │   'pydantic_openapi_schema': {                                      │ │
│ │                    │   │   │   'propagate': True,                                            │ │
│ │                    │   │   │   'level': 'WARNING',                                           │ │
│ │                    │   │   │   'handlers': ['queue_listener']                                │ │
│ │                    │   │   }                                                                 │ │
│ │                    │   },                                                                    │ │
│ │                    │   'root': {'handlers': ['queue_listener'], 'level': 'INFO'}             │ │
│ │                    }                                                                         │ │
│ │         deferred = []                                                                        │ │
│ │ disable_existing = False                                                                     │ │
│ │       EMPTY_DICT = {}                                                                        │ │
│ │         existing = [                                                                         │ │
│ │                    │   'opdba',                                                              │ │
│ │                    │   'opdba.domain.collection.routes',                                     │ │
│ │                    │   'starlite_bedrock.starlite.exceptions'                                │ │
│ │                    ]                                                                         │ │
│ │          filters = {                                                                         │ │
│ │                    │   'health_filter': <starlite_bedrock.starlite.logging.AccessLogFilter   │ │
│ │                    object at 0x10cbe83d0>                                                    │ │
│ │                    }                                                                         │ │
│ │       formatters = {'standard': <Formatter: fmt='%(message)s'>}                              │ │
│ │          handler = <starlite.logging.picologging.QueueListenerHandler object at 0x10cbb4140> │ │
│ │         handlers = {                                                                         │ │
│ │                    │   'console': <starlite_bedrock.starlite.logging.RichPicologgingHandler  │ │
│ │                    object at 0x10bec03c0>,                                                   │ │
│ │                    │   'queue_listener': <starlite.logging.picologging.QueueListenerHandler  │ │
│ │                    object at 0x10cbb4140>                                                    │ │
│ │                    }                                                                         │ │
│ │                i = 4                                                                         │ │
│ │      incremental = False                                                                     │ │
│ │          loggers = {                                                                         │ │
│ │                    │   'starlite_bedrock': {'propagate': True},                              │ │
│ │                    │   'uvicorn.access': {'propagate': True, 'filters': ['health_filter']},  │ │
│ │                    │   'uvicorn.error': {'propagate': True},                                 │ │
│ │                    │   'gunicorn.access': {                                                  │ │
│ │                    │   │   'propagate': True,                                                │ │
│ │                    │   │   'filters': ['health_filter']                                      │ │
│ │                    │   },                                                                    │ │
│ │                    │   'gunicorn.error': {'propagate': True},                                │ │
│ │                    │   'sqlalchemy': {'propagate': True},                                    │ │
│ │                    │   'starlite': {'level': 'WARNING', 'propagate': True},                  │ │
│ │                    │   'pydantic_openapi_schema': {                                          │ │
│ │                    │   │   'propagate': True,                                                │ │
│ │                    │   │   'level': 'WARNING',                                               │ │
│ │                    │   │   'handlers': ['queue_listener']                                    │ │
│ │                    │   }                                                                     │ │
│ │                    }                                                                         │ │
│ │             name = 'pydantic_openapi_schema'                                                 │ │
│ │     num_existing = 4                                                                         │ │
│ │            pflen = 24                                                                        │ │
│ │         prefixed = 'pydantic_openapi_schema.'                                                │ │
│ │             root = <Logger 'root' (INFO)>                                                    │ │
│ │             self = <picologging.config.DictConfigurator object at 0x10cbe8340>               │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /Users/codyfincher/Code/OPDBA/oracle-database-assessment/master/.venv/lib/python3.10/site-packag │
│ es/picologging/config.py:46 in _handle_existing_loggers                                          │
│                                                                                                  │
│    43 │   for log in existing:                                                                   │
│    44 │   │   logger = root.manager.loggerDict[log]                                              │
│    45 │   │   if log in child_loggers:                                                           │
│ ❱  46 │   │   │   if not isinstance(logger, picologging.PlaceHolder):                            │
│    47 │   │   │   │   logger.setLevel(picologging.NOTSET)                                        │
│    48 │   │   │   │   logger.handlers = []                                                       │
│    49 │   │   │   │   logger.propagate = True                                                    │
│                                                                                                  │
│ ╭────────────────────────────────── locals ───────────────────────────────────╮                  │
│ │    child_loggers = ['starlite_bedrock.starlite.exceptions']                 │                  │
│ │ disable_existing = False                                                    │                  │
│ │         existing = [                                                        │                  │
│ │                    │   'opdba',                                             │                  │
│ │                    │   'opdba.domain.collection.routes',                    │                  │
│ │                    │   'starlite_bedrock.starlite.exceptions'               │                  │
│ │                    ]                                                        │                  │
│ │              log = 'starlite_bedrock.starlite.exceptions'                   │                  │
│ │           logger = <Logger 'starlite_bedrock.starlite.exceptions' (NOTSET)> │                  │
│ │             root = <Logger 'root' (INFO)>                                   │                  │
│ ╰─────────────────────────────────────────────────────────────────────────────╯                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: module 'picologging' has no attribute 'PlaceHolder'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant