* Stephen Hahn <sch at sun.com> [2009-10-14 21:53]: > * Jordan Brown <Jordan.Brown at sun.com> [2009-10-11 17:47]: > > >> 1) Just printf them, and rely on SMF's output redirection. > > >> Problem: doesn't play nice with log rotation. > > >> ... > >>> But how about something like this? > >>> > >>> void > >>> log(char *fmt, ...) > >>> [ reopen logfile on each write ] > >> That isn't any better than just (1), because smf already gives each > >> thing a log, and I'm not sure what you meant above by "doesn't play > >> nice w/ log rotation" but those logs *are* rotated. There is a > >> single entry in logadm that triggers a script that rotates all smf logs. > > > > Sorry, I assumed context from the previous discussion a few months ago. > > > > The problem with log rotation is that the service has the log file open > > on its stdout and stderr, and when logadm rotates logs it does it by > > rename and so the open file descriptors refer to the archived log file, > > *not* to the new one. The server doesn't start writing to the new log > > file until it's restarted. > > There's an outstanding bug on this; the fix is trivial--use > logadm(1M)'s copy-truncate option.
6578671 smf services keep logging to old smf logs after log rotation as well, until we restart them I peeked at this bug when fixes were being discussed; a small patch to svc.startd(1M) to set stdout/stderr to O_APPEND would make for a complete fix. - Stephen -- sch at sun.com http://blogs.sun.com/sch/