[ale] prink's driving me crazy

Joe Steele joe at madewell.com
Wed Jan 30 22:03:36 EST 2002


On Tuesday, January 29, 2002 9:21 AM, Chris Fowler wrote:
> 
> I do not want any printk message of level 4 going to the console.  I changed linux-2.4.13/kernel/printk.c to look like this:
> 
> /* printk's without a loglevel use this.. */
> #define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
>
> /* We show everything that is MORE important than this.. */
> #define MINIMUM_CONSOLE_LOGLEVEL 5 /* Minimum loglevel we let people use */
> #define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */
>  
> 
> All  I changed was MINIMUM_CONSOLE_LOGLEVEL from 1 to 5.  Hoping that 4's will not be displayed on the console at boot.  Does anyone know a way
> to do this?  Obviously changing MINIMUM_CONSOLE_LOGLEVEL to 5 did not work.

This doesn't work they way you think.  'MINIMUM_CONSOLE_LOGLEVEL' 
only affects the kernel's syslog() function (see 'man 2 syslog', not 
'man 3 syslog').  More specifically, syslog() uses command '6' to 
'Disable printk's to console'.  It does this by setting 
'console_loglevel' to 'MINIMUM_CONSOLE_LOGLEVEL', which is defined to 
equal 1.  As 'man 2 syslog' states, only messages lower than 
'console_loglevel' are printed.  Also, syslog() command '8' cannot 
set the 'console_loglevel' any lower than 'MINIMUM_CONSOLE_LOGLEVEL'.  
So, redefining 'MINIMUM_CONSOLE_LOGLEVEL' to equal 5 means that 
syslog() commands '6' and '8' can never set 'console_loglevel' any 
lower than 5, meaning that levels 4 and less will always print.  In 
other words, you should leave 'MINIMUM_CONSOLE_LOGLEVEL' alone.  

> 
>
> I know I can do this with syslog(2) but that has to happen from my code.  I want this nailed at boot.  I'm open to use a lilo command line append option.
>  

My first suggestion is that you append the parameter 'quiet' to the 
kernel's command line.  I think this will do exactly what you want by 
initializing 'console_loglevel' to 4 at boot time, meaning that only 
levels less than 4 will print.  If that doesn't make things quiet 
enough for you, then go back to modifying printk.c and reduce 
'DEFAULT_CONSOLE_LOGLEVEL' (which is used to initialize 
'console_loglevel') from 7 downward to 3 or less.  

You will, of course, need to check your syslog.conf to verify that 
syslogd isn't being told to log higher level messages to the console.

--Joe

---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.






More information about the Ale mailing list