Please show to full code flow of

- starting application, your main entry point

- how and when it calls setup_loggers()

- how and when it imports modules

If necessary step it through yourself in a debugger (pdb).

On 7 December 2015 at 17:35, Anil Jangam <[email protected]> wrote:

> Hi Mikko,
>
> Yes, I did see that. However I believe that scenario talks about multiple
> modules creating the logger. In my case, I just have one python
> file/module, which is initializing the logger. I also tried pushing the
> importing the two imports (1. import logging, and 2. import logging.config)
> as a very last imports in the sequence but not successful.
>
> I am having the below imports in my code. I am relatively new to python
> and complete to uwsgi. Can you suggest what should be the correct sequence?
> Do I have to initialize the logger inside application() function, which is
> starting point of uwsgi?
>
> import sys
> import os
> import urllib2
> import urllib
> import simjsonrpc as jsonrpc
> import json
> import re
>
> from simjsonrpc import HttpRequest
> from settings import *
> from templates import *
> from http_defs import *
> import time
>
> import logging
> import logging.config
> import yaml
>
> from unix_sock_http import *
>
>
> /anil.
>
>
>
> On Mon, Dec 7, 2015 at 2:28 PM, Mikko Ohtamaa <[email protected]>
> wrote:
>
>> Hi Anil,
>>
>> Did you spot my SO.com comment on the matter?
>>
>> Thanks,
>> Mikko
>>
>> On 7 December 2015 at 17:27, Anil Jangam <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> This is a resend of my previous post.
>>>
>>> I need to understand how python logger works under uwsgi environment? I
>>> have a python program used as a --wsgi-file. This python application
>>> internally initializes a logging.Logger instance with a certain log config.
>>>
>>> What is happening is for the first time uwsgi process is started, it
>>> does not pick up the correct time format for log message as per the log
>>> config; however, when I restart the uwsgi process, it picks the configured
>>> time format.
>>>
>>> I tried few options outside the uwsgi process context but nothing
>>> helped. I need to know if there is anything within uwsgi framework or
>>> environment which influences the python logger time format?
>>>
>>> Thanks,
>>> /anil.
>>>
>>>
>>>
>>> On Fri, Dec 4, 2015 at 4:21 PM, Anil Jangam <[email protected]>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have a python module running behind the uwsgi process launched as
>>>> below. I have a python logger being initialized inside the json_rpc.py
>>>> file.
>>>>
>>>> uwsgi -M --processes 1 --threads 2 -s /tmp/uwsgi.sock 
>>>> --wsgi-file=/proj/req_proc.py --daemonize /dev/null
>>>>
>>>>
>>>> The issue is whenever the uwsgi process is started for the first time,
>>>> the logger time format is not taking effect as per the log configuration.
>>>> However, on the second attempt, when I restart the uwsgi process (after
>>>> doing a kill -9 on uwsgi), the logger time format comes out correct.
>>>>
>>>> I am not able to understand why this is happening and if there is
>>>> anything wring between python logger and uwsgi framework. Can someone
>>>> please comment on this?
>>>>
>>>> I posted similar question to stackoverflow and got a comment indicating
>>>> something wrong between the two.
>>>>
>>>> http://stackoverflow.com/questions/34053273/python-logger-not-picking-up-the-configure-time-format
>>>>
>>>> Thanks,
>>>> /anil.
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> uWSGI mailing list
>>> [email protected]
>>> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>>>
>>>
>>
>>
>> --
>> Mikko Ohtamaa
>> http://opensourcehacker.com
>> http://twitter.com/moo9000
>>
>>
>> _______________________________________________
>> uWSGI mailing list
>> [email protected]
>> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>>
>>
>
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
>


-- 
Mikko Ohtamaa
http://opensourcehacker.com
http://twitter.com/moo9000
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to