Logging with 2 process in application
gayatri funde
fundegayatri at gmail.com
Mon Feb 22 01:12:46 EST 2021
On Monday, February 22, 2021 at 11:33:57 AM UTC+5:30, Chris Angelico wrote:
> On Mon, Feb 22, 2021 at 5:01 PM gayatri funde <fundeg... at gmail.com> wrote:
> > I have 2 files mainModule.py and loggingModule.py files as below:
> > In loggingModule.py file i am managing new log to create , which i am importing to mainModule.py file.
> >
> > def child_Process(var1):
> > while True:
> > time.sleep(10)
> > logging.info('Log from Child Process')
> >
> > if __name__ == "__main__":
> > var1 = "LotsOfSunshine"
> > time.sleep(1)
> > logging.info("Log from Main process")
> >
> > child_Multiprocess = multiprocessing.Process(target=child_Process, args=(var1,))
> > child_Multiprocess.start()
> >
> When you spawn a subprocess, its variables are completely separate
> from the parent. I suspect that you'll do far FAR better with
> threading here, rather than trying to share things across processes.
>
> ChrisA
Thank you Chris!
But i have need of creating a another process instead of thread for application performance stand point.
Just i was trying to log both process events in a single file and just wanted to create each day new log for easy debug.
More information about the Python-list
mailing list