On Mon, Feb 22, 2021 at 4:41 PM gayatri funde <fundegaya...@gmail.com> wrote: > > On Monday, February 22, 2021 at 10:47:57 AM UTC+5:30, Dan Stromberg wrote: > > On Sun, Feb 21, 2021 at 9:10 PM gayatri funde <fundeg...@gmail.com> > > wrote: > > > Hello, > > > > > > Greetings!! Have a good day! > > > > > > This is regarding logging issue i am facing in my application. My > > > requirement is to create log on daily basis while my application is > > > running, So to do this i am creating new log file at midnight by comparing > > > the day it starts and enter to new day with the while loop continuously > > > checking on date. > > > > > > In my application i have 2 processes, So what my observation is on the day > > > of start of application both process are able to log into the file, but as > > > new day starts new file getting created and only main process log are > > > getting written into new file, and other process is still writing to old > > > day log. > > > > > > So could you please help me to understand this issue and it will be great > > > to know solution if you can help me with this. > > > > > Is it possible each process has open a different "file" on the same > > pathname, with only one actually being visible in the filesystem? > > > > Linuxes and Unixes allow such things. I am unaware of Windows being > > powerful enough to do so, and besides there you'd probably use the Event > > Log anyway. > > > > If that's the case, I do not know of a Python logging-module way of > > correcting the problem, but you could introduce a third process that is > > used just for logging, and have the original two send their log messages to > > the new 3rd logging process. > > > Just to clarify, file names are different as i am appending date to each file > name. On new day start main process is writing to new day file and another > process is still writing to old date file. This i am trying on Linux system. > > Thanks for suggestion of creating one dedicated process for logging. But if > you can help to find any is other reason why second process not able to find > the new day file handler object. > Thank you for your reply. >
You'll need to show your code. Most likely, though, BOTH processes need to independently update to the new file. ChrisA -- https://mail.python.org/mailman/listinfo/python-list