On 06/28/2012 09:41 AM, rong deng wrote: > Hi David, > > I've come up with an idea to accommodate this situation, tell me if > it's useful for you or there's a better solution. :) I think this solution (to go with .1, .2 etc prefix) is good enough for me. A question about the implementation though - is it racy? I'm not completely sure if two clients which in parallel try to spawn the server, end up choosing the same file name. Would opening with O_EXCL work as a test instead, perhaps? > > So I've added a new syntax when we specified the file log target. The > original one is file:<PATH>, now it's newfile:<PATH>. This syntax > would: > 1. check if PATH file exists or not, if it doesn't exist, then > everything is OK, we're not overriding anything, we do the original > code route. > 2. now unfortunately this file exists, then we try PATH.1, PATH.2, > PATH.3 .... until we find a non-existent file, let's say it's PATH.5, > so we create the PATH.5 as our log file target. > > Any comments are welcome. > > The patch is attached. > > 2012/6/11 David Henningsson <david.henningsson at canonical.com>: >> On 06/11/2012 02:35 AM, rong deng wrote: >>> >>> 2012/6/4 David Henningsson<david.henningsson at canonical.com>: >>>> >>>> Sometimes I have users who complain about some problem, but after a >>>> "pulseaudio -k" the problem is gone. Therefore asking them to restart >>>> pulseaudio with -vvvv switch will not give any information about the >>>> error. >>>> >>>> * I could log to syslog (the default), but once I enable debug level >>>> log, >>>> the syslog daemon can start to ratelimit, especially during the startup >>>> phase of pulseaudio. >>>> >>>> * I could log to file, but then that file would quickly get overwritten, >>>> as >>>> soon as pulseaudio restarts. >>>> >>>> Is there a trick I'm missing here? Or would it be possible to add some >>>> kind >>>> of expansion to the log file name to make the files unique? >>> >>> >>> Hi David, >>> >>> I'm doing the GSoC to enhance the logging functionality in pulseaudio, >>> I could take a look at this issue and try to improve it a little bit. >>> :) >> >> >> Yes, I was actually thinking the same :-) Thanks! >> >> Not sure how to do it in the best way though. I'm figuring that at least a >> timestamp and pid should be possible to insert into the log file name in a >> configurable way. >> Also we probably don't want to reinvent the wheel but use the expansion >> mechanisms provided by ...something around us, or some library we're already >> depending on, if we can find anything of use? >> Maybe someone else knows more on the topic. >> >> >> -- >> David Henningsson, Canonical Ltd. >> https://launchpad.net/~diwic -- David Henningsson, Canonical Ltd. https://launchpad.net/~diwic