logging

25 views
Skip to first unread message

Giovanni Colapinto

unread,
Mar 26, 2016, 5:05:39 AM3/26/16
to API-Hour
Hi.

I'm unable to make log works.

logging.ini
[loggers]
keys=root,pywarnings,asyncio,gunicorn,aiohttp,api_hour,spyrest
[logger_spyrest]
level=DEBUG
handlers=console,syslog
qualname=spyrest
propagate=0

If I use
LOG = logging.getLogger('spyrest')

Or
LOG = logging.getLogger(__name__)

No logs to conseol or in /var/log/syslog

Giovanni







Giovanni Colapinto

unread,
Mar 26, 2016, 5:56:01 AM3/26/16
to API-Hour
If I add

logging.config.fileConfig('conf/api_hour/logging.ini')

The log system works as expected

It seems that api_hour do not load logging.ini

Ludovic Gasc

unread,
Apr 4, 2016, 3:49:48 AM4/4/16
to Giovanni Colapinto, API-Hour
Hi Giovanni,

Welcome in API-Hour community ;-)

About your question itself, how you launch your daemon ?
If you didn't use the dev_server.sh in starter kit, you need to use "-ac" parameter: http://pythonhosted.org/api_hour/tutorials/with_starter_kit.html#launch

By default, API-Hour let you to configure your daemon like you want, via Gunicorn.

Have a nice day.

--
Ludovic Gasc (GMLudo)

--
You received this message because you are subscribed to the Google Groups "API-Hour" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-hour+u...@googlegroups.com.
To post to this group, send email to api-...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/api-hour/c1f2913f-f725-4889-a896-291b1dbf5dd7%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Giovanni Colapinto

unread,
Apr 13, 2016, 9:04:39 AM4/13/16
to API-Hour
I launch the dev server with this command:

api_hour -c conf/api_hour/gunicorn_conf.py --config_dir conf spyrest:Container

gunicorn_conf.py:
import multiprocessing

workers = multiprocessing.cpu_count() * 2 + 1

keepalive = 15
pidfile = '/run/lock/spyrest.pid'
backlog = 10240000
bind = "0.0.0.0:8001"

Thanks






On Saturday, 26 March 2016 10:05:39 UTC+1, Giovanni Colapinto wrote:

Ludovic Gasc

unread,
May 6, 2016, 4:28:01 AM5/6/16
to Giovanni Colapinto, API-Hour
You need at least to add -ac in command line, and in your logging.ini, define at least your two handlers: console and syslog
Define also a formatter.


BTW, I recommend you to read logging documentation: at first glance, an inexperienced developer could think that python logging is overcomplicated for his needs, but after several deployments on production, I can guarantee you that it's a must have ;-)


--
Ludovic Gasc (GMLudo)

--
You received this message because you are subscribed to the Google Groups "API-Hour" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-hour+u...@googlegroups.com.
To post to this group, send email to api-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages