Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Where is the output of printk?

    I am working in the x concole. I can't see the printk from the screen.
    I am wondering what is the difference of the following files:


    I can't see the output from /var/log/messages or dmesg.......however,
    i can see it from /var/log/syslog.

    Why?? Can I revise something to control it to let the printk output go to where I want?


  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    St. Petersburg, FL
    i assume you're using C?
    why not:
    printf("What up yo?");
    hey just realized you're doing module programming :/

  3. #3

    Do you know their difference?

    yeah, I am programming the module. Do you know why my output of printk goes to /var/log/syslog?


  4. $spacer_open
  5. #4
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    St. Petersburg, FL
    yeah cos that's where the kernel keeps its logs in

  6. #5
    Linux Guru
    Join Date
    Oct 2001
    Täby, Sweden
    printk's output goes to several places:

    1. The system console (default is the currently active text mode VT).
    2. It gets sent to /proc/kmsg.

    /proc/kmsg is a binary interface for retrieving kernel messages and setting kernel logging settings. Normally, the only process using it is klogd, which captures all kernel log messages and passes them on to syslogd. syslogd then multiplexes them to a couple of files, depending on what is configured in /etc/syslog.conf. Normally, messages of the DEBUG priority are discarded, so if you're logging with printk(KERN_DEBUG "..."), syslogd will discard them.

    See the syslog(3) and syslogd(8) and syslog.conf(5) manpages for more info on syslogging. I normally add these lines to my /etc/syslog.conf on a new system, in order to be able to see all log messages easily:
    *.* /dev/tty12
    *.* /var/log/all
    Also, there's an ioctl that you can use to redirect the system console output to another terminal -- you open a terminal and run this ioctl with no parameters on it, and the console output will get there. See tty_ioctl(4) for more info. The only program I know of right now that can do this is screen. Run the command C-a : console RET in screen to make it display the console output. I believe, although I'm not sure, that it will not show debug message, however. The best option may be to make syslogd redirect the output where you want it. Remember "tail -f".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts