Re: dumb question: How to create your own log files in a kernel module?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Xin,

I know printk can do this job. But what I really want is to print logs
to a file specified by me instead of /var/log/messages. And, the
messages irrelevant to my module should not be written into that file.
Now my log mixed with other logs in /var/log/message, which bother me
much. :(

You seem to make a confusion here...

Don't forget that files are only an abstraction for userspace. They are only meant to be read and written from userspace. Kernel code can never read or write files. In the case of /var/log/messages, this file is created by the syslogd program from the kernel buffer, not by the kernel itself.

You could just echo something specific to your driver in your printk strings, and grep this specific thing in /var/log/messages. You have your file!

   Cheers,

   Michael.

--
Michael Opdenacker
http://free-electrons.com
+33 621 604 642

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux