Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 06 Apr 2015 15:49:44 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-current@freebsd.org
Cc:        Eric Badger <eric@badgerio.us>, 'Poul-Henning Kamp' <phk@phk.freebsd.dk>
Subject:   Re: Early use of log() does not end up in kernel msg buffer
Message-ID:  <2033248.Eu3RHS8lTG@ralph.baldwin.cx>
In-Reply-To: <5514CC6D.3020607@badgerio.us>
References:  <5514CC6D.3020607@badgerio.us>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, March 26, 2015 10:20:13 PM Eric Badger wrote:
> Using log(9) when no process is reading the log results in the message 
> going only to the console (contrast with printf(9), which goes to the 
> console and to the kernel message buffer in this case). I believe it is 
> truer to the semantics of logging for messages to *always* go to the 
> message buffer (where they can eventually be collected and in fact put 
> into a logfile). I therefore propose the attached patch, which sends 
> log(9) to the message buffer always, and to the console only if no one 
> has yet opened the log.
> 
> It may be more complete to log to the console only if the log level is 
> greater than some (user defined) value, but this seems like that might 
> be more than necessary for this case.
> 
> Thoughts?

I think phk@ broke this back in 70239.  Before that the log() function did
this:

log()
{

	/* log to the msg buffer */
	kvprintf(fmt, msglogchar, ...);

	if (!log_open) {
		/* log to console */
		kvprintf(fmt, putchar, ...);
	}
}

I think your patch is fine unless phk@ (cc'd) has a reason for not wanting to
do this.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2033248.Eu3RHS8lTG>