From: Michael Opdenacker <michael@free-electrons.com>
To: Xin Zhao <uszhaoxin@gmail.com>
Cc: linux-os@analogic.com, linux-kernel@vger.kernel.org
Subject: Re: dumb question: How to create your own log files in a kernel module?
Date: Fri, 29 Apr 2005 00:00:46 +0200 [thread overview]
Message-ID: <42715D0E.7020108@free-electrons.com> (raw)
In-Reply-To: <4ae3c1405042813591f0b5962@mail.gmail.com>
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
next prev parent reply other threads:[~2005-04-28 22:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-28 18:10 dumb question: How to create your own log files in a kernel module? Xin Zhao
2005-04-28 20:06 ` Richard B. Johnson
2005-04-28 20:59 ` Xin Zhao
2005-04-28 22:00 ` Michael Opdenacker [this message]
2005-04-28 22:04 ` Chris Wedgwood
[not found] <3YlMk-iH-9@gated-at.bofh.it>
[not found] ` <3YnEA-1VB-27@gated-at.bofh.it>
[not found] ` <3YoqV-2JA-31@gated-at.bofh.it>
2005-04-28 23:28 ` Bodo Eggert <harvested.in.lkml@posting.7eggert.dyndns.org>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42715D0E.7020108@free-electrons.com \
--to=michael@free-electrons.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-os@analogic.com \
--cc=uszhaoxin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox