Are you using embedded mode or daemon mode of mod_wsgi?

It sounds like you are using embedded mode of mod_wsgi and modifying or 
updating the time stamp on the WSGI script file for the application, causing it 
to be reloaded in the context of the same process. If that WSGI script is 
trigger initialisation of logging, then it will be triggered it a subsequent 
time for the process.

Ideally you should be using daemon mode as it is the recommended configuration. 
Otherwise you would need to code up the WSGI script file to not perform process 
initialisation if it has already been done.

Check out how reloading works in:

https://modwsgi.readthedocs.io/en/develop/user-guides/reloading-source-code.html
 
<https://modwsgi.readthedocs.io/en/develop/user-guides/reloading-source-code.html>

Also:

https://modwsgi.readthedocs.io/en/develop/user-guides/checking-your-installation.html#embedded-or-daemon-mode
 
<https://modwsgi.readthedocs.io/en/develop/user-guides/checking-your-installation.html#embedded-or-daemon-mode>

Graham

> On 11 Sep 2019, at 1:34 am, Jared Greenwald <greenwaldja...@gmail.com> wrote:
> 
> I'm in the midst of converting an application from mod_python to mod_wsgi and 
> I'm having an issue with our logging functionality.  We have a centralized 
> init function for logging that runs getLogger and sets up the file handler 
> object and things like that.  There's also a centralized log function that 
> also calls getLogger to write out to the log.  We also have two separate 
> namedvirtualhost configs in our global apache config - one for localhost for 
> admin type operations and one for the external interface for client/customer 
> operations (I have an environment variable in each VH config stanza that 
> points to an environment-specific config file that identifies the log file 
> for that environment among other things).  I'm seeing the application logging 
> to the correct log file for each environment, but at times I'm getting 
> duplicate log entries (I've gotten it up to x8).  I know it's not actually 
> duplicating the work as I have a couple places where I use mkstemp and I'm 
> seeing the same temp file name in each duplicated log output.  So, I'm 
> guessing there's something to do with how the centralized convenience 
> functions are setting up and calling the logging library functions.  Is there 
> any best practice guide on how to do logging properly under mod_wsgi?  I 
> should also point out that this setup works under mod_python/python2.4 (vs 
> mod_wsig/python2.7).
> 
> Thanks,
> Jared
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to modwsgi+unsubscr...@googlegroups.com 
> <mailto:modwsgi+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/cdedca07-b5fb-4e58-a16f-661c2a5a2251%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/modwsgi/cdedca07-b5fb-4e58-a16f-661c2a5a2251%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/36F9613B-2A8B-47F8-98C0-135769FB8524%40gmail.com.

Reply via email to