diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -153,6 +153,10 @@ SYSCTL_INT(_kern, OID_AUTO, always_console_output, CTLFLAG_RWTUN, &always_console_output, 0, "Always output to console despite TIOCCONS"); +static int console_log_level = LOG_ERR; +SYSCTL_INT(_kern, OID_AUTO, console_log_level, CTLFLAG_RWTUN, + &console_log_level, 0, "Console event log level"); + /* * Warn that a system table is full. */ @@ -292,6 +296,12 @@ pca.p_bufr = NULL; #endif + if (!log_open && pca.pri > console_log_level && + constty == NULL) { + /* Drop this message, console writes are expensive */ + return (0); + } + retval = kvprintf(fmt, putchar, &pca, 10, ap); #ifdef PRINTF_BUFR_SIZE