Skip to main content
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
""",

Download files

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

Source Distribution

PyramidLogService-0.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyramidLogService-0.1-py3.5.egg (12.9 kB view details)

Uploaded Egg

File details

Details for the file PyramidLogService-0.1.tar.gz.

File metadata

File hashes

Hashes for PyramidLogService-0.1.tar.gz
Algorithm Hash digest
SHA256 16395f6f9b925a4b4debde20904df0e06487fba9af181ec543713e7c1a734f4e
MD5 13ac32895a510e6d27dd03ebd47ab06c
BLAKE2b-256 e00709de8aa35f3847899a5dc2a6a3f2306e6bb1302e16d82bee7db2a572f505

See more details on using hashes here.

File details

Details for the file PyramidLogService-0.1-py3.5.egg.

File metadata

File hashes

Hashes for PyramidLogService-0.1-py3.5.egg
Algorithm Hash digest
SHA256 205dc9269eb862a54e75cf0c037c4aedad0988ef2eabd977ba12cddcdaf1b516
MD5 f56452ef2aff8a8a0e8cd329d8c6a3c0
BLAKE2b-256 ea6162b71e4f357c07f9c643bb33f52dabcf999decbdfe6787649dbd5b4acaf8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page