Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Pyramid LogService

Project Description
README
======

This package is meant to be used to setup logging to the database from a pyramid application.
To include in a pyramid application you need to alter the development.ini/production.ini files.

EXAMPLE INI FILE
================

[loggers]
keys = root, myapp

[handlers]
keys = console, sqlalchemy

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_myapp]
level = DEBUG
handlers = sqlalchemy
qualname = myapp

[handler_sqlalchemy]
class = logservice.handlers.sqlalchemy_handler.SQLAlchemyHandler
args = ()
level = NOTSET
formatter = generic

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s


You will also want to create an initialize_log_db.py file in your scripts folder

EXAMPLE initialize_log_db.py
============================

import os
import sys
from logservice.scripts import initializedb

from pyramid.paster import (
get_appsettings,
setup_logging,
)

from pyramid.scripts.common import parse_vars


def usage(argv):
cmd = os.path.basename(argv[0])
print('usage: %s <config_uri> [var=value]\n'
'(example: "%s development.ini")' % (cmd, cmd))
sys.exit(1)


def main(argv=sys.argv):
if len(argv) < 2:
usage(argv)
config_uri = argv[1]
options = parse_vars(argv[2:])
setup_logging(config_uri)
settings = get_appsettings(config_uri, options=options)
log = initializedb.InitializeDb(settings['sqlalchemy.url'])
log.initialize_db()


EXAMPLE setup.py change
=======================

entry_points = """\
[paste.app_factory]
main=myapp:main
[console_scripts]
initialize_log_db = myapp.scripts.initialize_log_db:main
""",
Release History

Release History

This version
History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
PyramidLogService-0.1-py3.5.egg (12.9 kB) Copy SHA256 Checksum SHA256 3.5 Egg Oct 8, 2016
PyramidLogService-0.1.tar.gz (3.8 kB) Copy SHA256 Checksum SHA256 Source Oct 8, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting