On Sat, Sep 13, 2014 at 8:16 AM, Ludovic Courtès <l...@gnu.org> wrote: > David Michael <fedora....@gmail.com> skribis: >> On Thu, Sep 11, 2014 at 10:31 AM, Ludovic Courtès <l...@gnu.org> wrote: [snip] >>> The ideal thing would be: >>> >>> 1. Run ‘dmd -l foo.log’. >>> 2. If foo.log is not writable, then make ‘log-output-port’ a string >>> port. >> >> Do you think it makes sense to define log-output-port as a string port >> at first instead of a void port? > > No, because running dmd without ‘-l’ means disabling logging altogether, > hence the void port.
That doesn't appear to be the case. The main procedure in modules/dmd.scm is calling start-logging unconditionally, with the default log file if the option is omitted. >>> 3. When foo.log becomes writable, have ‘log-output-port’ point to it >>> and dump previously buffered data. >>> >>> But #3 is difficult. >>> >>> Maybe instead of using a string port, we could use a string port that >>> keeps trying to open the log file? >>> >>> It would be best to use inotify (or the Hurd’s fs_notify), of course. >> >> Something like that would be a nice transparent solution for read-only >> booting, but I could see another issue arising from it later. It's >> common to have /var or /var/log on a different volume that may not be >> mounted when the root file system's /var/log is writable. Writing >> logs as soon as possible could miss the sysadmin's desired log volume >> (which theoretically could also happen with dmd as is). > > Right, that makes sense. I think it’s a good argument against trying to > do something too smart. > > So probably the patch you propose is the best approach. > > Then I would suggest a small change: instead of the magic > ‘--log-file=delayed’, what about adding a new option, say, > ‘--buffered-log’? WDYT? Yes, I think a separate option would be better. If it's expected that users will handle early mount configuration in their dmdconf.scm, separate options could allow doing something like specifying both options and starting to write to the given log file automatically after processing dmdconf.scm, if it wasn't started explicitly. That could at least remove the need for the user to have to know to start logging themselves. I haven't had a chance to try rewriting this yet, but I can send a new version when I do. Thanks. David