{ "info": { "author": "Aru Sahni", "author_email": "aru@thehumangeo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: No Input/Output (Daemon)", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: System :: Logging" ], "description": "Multilog\n========\n\n.. image:: https://travis-ci.org/humangeo/multilog.svg\n :target: https://travis-ci.org/humangeo/multilog\n\n.. image:: https://coveralls.io/repos/github/humangeo/multilog/badge.svg?branch=master\n :target: https://coveralls.io/github/humangeo/multilog?branch=master\n\nA simple, multiprocess-safe logger for Python\n\nWhy\n---\n\nPython's built-in loggers are pretty handy - they're easily customized and come with useful functionality out\nof the box, including things like file rotation. These file handlers are thread-safe, but not process-safe, so, if\nyou're running a webserver in a pre-forking environment, for example, you run the risk of your workers trampling\nover each other when writing to a common log file. File locking is a possible workaround, but that's yucky.\n\nTo avoid this, it is recommended that one uses a socket-based logger (`a code sample is helpfully provided in the\nLogging Cookbook `_). However, it is just a code snippet.\nMultilog is a dependency-free implementation of the sample socket logger with some niceties, like fileConfig\nsupport, and parameterization.\n\nHow\n-------------------------\n\nOnce installed, the Multilog daemon can be invoked via:\n\n.. code-block:: console\n\n mutlilog\n\nUsage:\n\n.. code-block:: console\n\n usage: multilog [-h] [-s SERVER] [-p PORT] [-c CONFIG_PATH]\n\n A simple logger for multiple Python processes.\n\n optional arguments:\n -h, --help show this help message and exit\n -s SERVER, --server SERVER\n The server hostname (default: localhost)\n -p PORT, --port PORT The port to listen on. (default: 9020)\n -c CONFIG_PATH, --config CONFIG_PATH\n The log configuration to load. (default: logging.ini)\n\nBy default, it will look for a ``logging.ini`` file in the current directory. If one isn't found, Multilog will\nyell at you. A sample configuration file for the server:\n\n.. code-block:: ini\n\n [loggers]\n keys=root\n\n [handlers]\n keys=multilogServerHandler\n\n [formatters]\n keys=simpleFormatter\n\n [logger_root]\n level=NOTSET\n handlers=multilogServerHandler\n\n [handler_multilogServerHandler]\n class=handlers.TimedRotatingFileHandler\n level=DEBUG\n formatter=simpleFormatter\n args=('/var/log/appName/appName.log', 'midnight')\n\n [formatter_simpleFormatter]\n class=logging.Formatter\n format=%(asctime)s %(levelname)7s: PID: %(process)5s | %(message)s [in %(pathname)s:%(lineno)d]\n\nand for your application:\n\n.. code-block:: ini\n\n [loggers]\n keys=root\n\n [handlers]\n keys=multilogClientHandler\n\n [formatters]\n keys=simpleFormatter\n\n [logger_root]\n level=NOTSET\n handlers=multilogClientHandler\n\n [handler_multilogClientHandler]\n class=handlers.SocketHandler\n level=DEBUG\n formatter=simpleFormatter\n args=('localhost', handlers.DEFAULT_TCP_LOGGING_PORT)\n\n [formatter_simpleFormatter]\n class=logging.Formatter\n format=%(asctime)s %(levelname)7s: PID: %(process)5s | %(message)s [in %(pathname)s:%(lineno)d]\n\n\nThe important field is the ``args`` block in the ``handler_multilogClientHandler`` section - those parameters should correspond to the server and ports on which the multilog daemon is listening. By default, the daemon uses ``localhost`` and ``logging.handlers.DEFAULT_TCP_LOGGING_PORT``.\n\nFor Power Users\n---------------\n\nIf you want to have Multilog share your application's config, you can do the following:\n\n.. code-block:: ini\n\n [loggers]\n keys=root,appName\n\n [handlers]\n keys=multilogClientHandler,multilogServerHandler\n\n [formatters]\n keys=simpleFormatter\n\n [logger_root]\n level=NOTSET\n handlers=%(root_handler)s\n\n [logger_appName]\n level=INFO\n handlers=\n propagate=1\n qualname=appName\n\n [handler_multilogClientHandler]\n class=handlers.SocketHandler\n level=DEBUG\n formatter=simpleFormatter\n args=('localhost', handlers.DEFAULT_TCP_LOGGING_PORT)\n\n [handler_multilogServerHandler]\n class=handlers.TimedRotatingFileHandler\n level=DEBUG\n formatter=simpleFormatter\n args=('/var/log/appName/appName.log', 'midnight')\n\n [formatter_simpleFormatter]\n class=logging.Formatter\n format=%(asctime)s %(levelname)7s: PID: %(process)5s | %(message)s [in %(pathname)s:%(lineno)d]\n\nThen, in your application, pass the root handler name into the logging config:\n\n.. code-block:: python\n\n import logging\n logging.config.fileConfig(config_path, defaults={\"root_handler\": \"multilogClientHandler\"})\n\nMultilog will always load the ``multilogServerHandler`` handler. If you don't want to run Multilog (if you're running a single-threaded local dev server, for example), simply change your ``root_handler`` value to ``multilogServerHandler`` to write to the handler.\n\nSupport\n-------\n\nMultilog is compatible with Python 2.6, 2.7, and 3.3+.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/humangeo/multilog", "keywords": "server multiprocess multiproc parallel logger logging logs", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "multilog", "package_url": "https://pypi.org/project/multilog/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/multilog/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/humangeo/multilog" }, "release_url": "https://pypi.org/project/multilog/1.1.0/", "requires_dist": null, "requires_python": null, "summary": "A simple logger for multiple Python processes.", "version": "1.1.0" }, "last_serial": 1945656, "releases": { "0.9.0": [ { "comment_text": "", "digests": { "md5": "32c06a68c413144962073419803c1227", "sha256": "1bde8f84c0e51442a5f5ad837848c8762e406dc1c5f23bcd0975d572cd29f326" }, "downloads": -1, "filename": "multilog-0.9.0.tar.gz", "has_sig": false, "md5_digest": "32c06a68c413144962073419803c1227", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5177, "upload_time": "2016-01-24T23:15:48", "url": "https://files.pythonhosted.org/packages/0e/6d/2d88812850c95cab7e7abc415e95bc1e921276dbe71e54b3b90e49510ff1/multilog-0.9.0.tar.gz" } ], "0.9.0dev": [], "1.0.0": [ { "comment_text": "", "digests": { "md5": "af7f9474fd857e3683d77839f0abe6c5", "sha256": "b1914814013a8bd455aefcfd26a26f2440995f158ab6d7bc504e247339bf07cb" }, "downloads": -1, "filename": "multilog-1.0.0.tar.gz", "has_sig": false, "md5_digest": "af7f9474fd857e3683d77839f0abe6c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5223, "upload_time": "2016-02-05T20:12:56", "url": "https://files.pythonhosted.org/packages/0e/f7/17517dbd5418e41cd5d332fccc197ff893fab6c43bdaeb62fc04c4cceab6/multilog-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "890c9312bdfc8ce61a835cb4150fa9c7", "sha256": "3e1774fea21f8e06cb72ceab8c4c0f457d21a41342d1f2d10bd41a1668f05991" }, "downloads": -1, "filename": "multilog-1.1.0.tar.gz", "has_sig": false, "md5_digest": "890c9312bdfc8ce61a835cb4150fa9c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5317, "upload_time": "2016-02-08T13:55:02", "url": "https://files.pythonhosted.org/packages/3c/2e/609b8488313cefa6c3ce757357155de7be1014d823224a88a2ffba32f725/multilog-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "890c9312bdfc8ce61a835cb4150fa9c7", "sha256": "3e1774fea21f8e06cb72ceab8c4c0f457d21a41342d1f2d10bd41a1668f05991" }, "downloads": -1, "filename": "multilog-1.1.0.tar.gz", "has_sig": false, "md5_digest": "890c9312bdfc8ce61a835cb4150fa9c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5317, "upload_time": "2016-02-08T13:55:02", "url": "https://files.pythonhosted.org/packages/3c/2e/609b8488313cefa6c3ce757357155de7be1014d823224a88a2ffba32f725/multilog-1.1.0.tar.gz" } ] }