Skip to main content

A Python logging handler for Treasure Data Cloud

Project description

td-loger: logging library for Treasure Data Cloud


Before using this logging handler, td-agent must be properly configured at the
localhost. Please confirm these settings are in your

## built-in TCP input
type tcp

# Treasure Data output
# match events whose tag is td.DATABASE.TABLE
<match td.*.*>
type tdlog

For more information, please look at the documentation.



$ easy_install td-logger


$ pip install td-logger


Check out the tests folder for more samples.

import logging
from tdlog import logger

l = logging.getLogger('td_logger.test')
l.addHandler(logger.TreasureDataHandler())'Some message')
js = { "semicolon" : ";", "at" : "@" }

This will throw the log entries to the local td-agent. And there's an important
point. This logger accepts only 'dict' and 'json string'.

Also, these parameters are logged by default.

* sys_host
* sys_name
* sys_module
* sys_lineno
* sys_levelno
* sys_levelname
* sys_filename
* sys_funcname
* sys_exc_info
* msg

These parameters can be specified at TreasureDataHander constructor.

* host: td-agent host (default:
* port: td-agent port (default: 24224)
* db: td database name (default: log)
* table: td table name (default: default)
* bufmax: buffer size max when td-agent is unavailable (default: 1*1024*1024)
* timeout: network timeout (default: 3.0)

Have fun!

How to Develop

Folloings are the way to setup development envionment on MacOSX.

$ sudo easy_install virtualenv
$ virtualenv --no-site-packages .
New python executable in ./bin/python
Installing setuptools............done.
Installing pip...............done.
$ source bin/activate
$ bin/pip install msgpack-python
$ python

Special Thanks

- [Joshua Kuntz]( for the original work

Project details

Download files

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

Source Distribution

td-logger-0.4.3.tar.gz (3.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page