{"id":14690,"library":"logutils","title":"Logutils: Legacy Logging Utilities for Python","description":"Logutils is a collection of logging utilities designed for Python. Its last release (0.3.5) was in 2012, and the library is no longer actively maintained. Many of the features it provided, such as `QueueHandler` and `WatchedFileHandler`, have since been integrated into Python's standard `logging` module or are available via more modern, actively maintained libraries.","status":"abandoned","version":"0.3.5","language":"en","source_language":"en","source_url":"https://pypi.org/project/logutils/","tags":["logging","utilities","abandoned","legacy"],"install":[{"cmd":"pip install logutils","lang":"bash","label":"Install logutils"}],"dependencies":[],"imports":[{"note":"This import is for the abandoned logutils library. Modern Python should use 'from logging.handlers import QueueHandler'.","symbol":"QueueHandler","correct":"from logutils.queue import QueueHandler"},{"note":"This import is for the abandoned logutils library. Modern Python applications typically manage queue listeners differently or use 'logging.handlers.QueueListener' (Python 3.2+).","symbol":"QueueListener","correct":"from logutils.queue import QueueListener"}],"quickstart":{"code":"import logging\nfrom logutils.queue import QueueHandler, QueueListener\nimport queue\nimport time\n\n# --- WARNING: This code uses the abandoned logutils library. ---\n# --- It is provided for historical context only.             ---\n# --- Modern applications should use the standard 'logging' module. ---\n\n# Setup a basic handler for the listener to write to\nfile_handler = logging.FileHandler('legacy_app.log')\nformatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')\nfile_handler.setFormatter(formatter)\n\n# Create a queue for logs\nlog_queue = queue.Queue(-1)\n\n# Create a QueueHandler to put messages into the queue\nqueue_handler = QueueHandler(log_queue)\n\n# Create a QueueListener to pull messages from the queue and send to the file handler\n# Note: QueueListener from logutils is deprecated; logging.handlers.QueueListener is preferred.\nqueue_listener = QueueListener(log_queue, file_handler)\n\n# Get a logger and add the queue handler\nlogger = logging.getLogger('legacy_app')\nlogger.setLevel(logging.INFO)\nlogger.addHandler(queue_handler)\n\n# Start the listener thread\nqueue_listener.start()\n\ntry:\n    logger.info('This is an info message from logutils.')\n    logger.warning('A warning message via logutils.')\n    time.sleep(0.1)\nfinally:\n    # Stop the listener gracefully\n    queue_listener.stop()\n    print('Log messages processed (check legacy_app.log if file was written).')\n    # In a real scenario, you'd ensure the file handler is closed properly.\n\n# --- Modern Python Alternative Example (conceptual) ---\n# from logging.handlers import QueueHandler, QueueListener\n# import logging.config\n# import queue\n\n# q = queue.Queue(-1)\n# queue_handler = QueueHandler(q)\n\n# listener = QueueListener(q, logging.FileHandler('modern_app.log'))\n# listener.start()\n# # ... logging code ...\n# listener.stop()\n","lang":"python","description":"This quickstart demonstrates how the `logutils.queue.QueueHandler` and `logutils.queue.QueueListener` *used* to be used for asynchronous logging. It is provided for historical context only. Modern Python applications should leverage the `logging.handlers.QueueHandler` and `logging.handlers.QueueListener` (available since Python 3.2), or other concurrent logging patterns, from the standard library."},"warnings":[{"fix":"Do not use `logutils` in new projects. For existing projects, migrate to Python's standard `logging` module.","message":"The `logutils` library is abandoned and has not been updated since 2012. It may have compatibility issues or rely on Python 2.x specific behaviors when run on modern Python 3.x environments.","severity":"breaking","affected_versions":"0.3.5 and earlier"},{"fix":"Prefer `import logging` and `import logging.handlers` for all your logging needs. Consult the official Python documentation for `logging`.","message":"Many features originally provided by `logutils` (e.g., `WatchedFileHandler`, `TimedRotatingFileHandler`, `QueueHandler`) have been integrated into Python's standard `logging` module since Python 2.6 and 3.1, or `logging.handlers` since Python 3.2.","severity":"gotcha","affected_versions":"All versions of `logutils`"},{"fix":"Remove `logutils` from your project's dependencies and replace its functionality with equivalent features from the standard `logging` library or other actively maintained logging extensions.","message":"The maintainers of `logutils` are no longer active, and the project's official website is defunct. There are no ongoing security updates or bug fixes.","severity":"deprecated","affected_versions":"All versions (0.3.5 and earlier)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"If you genuinely need `logutils` (highly discouraged), run `pip install logutils`. Otherwise, migrate your code to use the standard `logging` module and its submodules (e.g., `logging.handlers`).","cause":"`logutils` is not part of Python's standard library and needs to be installed, or you are trying to use a feature that is now in `logging`.","error":"ModuleNotFoundError: No module named 'logutils'"},{"fix":"Change your import statement from `import logging` to `from logging.handlers import QueueHandler`. If you were trying to use `logutils.queue.QueueHandler`, migrate to `logging.handlers.QueueHandler`.","cause":"You are attempting to access `QueueHandler` directly from the `logging` module, but it resides in `logging.handlers`.","error":"AttributeError: module 'logging' has no attribute 'QueueHandler'"}],"ecosystem":"pypi"}