From: greg.freemyer@gmail.com (Greg Freemyer)
To: kernelnewbies@lists.kernelnewbies.org
Subject: kernel space logging
Date: Fri, 25 Mar 2011 14:04:58 -0400 [thread overview]
Message-ID: <AANLkTimxxq1MoFwrUOgzXXSw24qq04yi=5KKAZAaMAnx@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinp97vR=+0NWtW8iQ5Szx3=5pjz2bUZZ1j5vF34@mail.gmail.com>
On Fri, Mar 25, 2011 at 1:43 PM, Anand Arumugam <anand.arumug@gmail.com> wrote:
> On Thu, Mar 24, 2011 at 5:47 PM, Greg Freemyer <greg.freemyer@gmail.com> wrote:
>> On Tue, Mar 22, 2011 at 1:13 PM, Anand Arumugam <anand.arumug@gmail.com> wrote:
>>> Hello all!
>>>
>>> I would like to know how logging is done while the kernel is booting
>>> up. More importantly I am looking for those files in the kernel source
>>> that handles the logging part. Also I would like to know what gets
>>> logged after the kernel is up and running.
>>>
>>> Thanks for your time.
>>>
>>> cheers,
>>> -anand.
>>
>> Are you talking about the logs you see when you run dmesg?
>>
>> You are aware the kernel maintains a ring buffer that all printk's go into.
>>
>> Then there are API's that let userspace track the buffer and put the
>> messages into on disk logs.
>>
>> dmesg just dumps out the ring buffer queue.
>>
>> The userspace API to the ring buffer is syslog().
>>
>> So during bootup I _assume_ the kernel is just logging to the ring
>> buffer, and then when the system is operational enough, userspace gets
>> all the boot messages out of the kernel via syslog() and puts them to
>> on disk log files.
>>
>> It's not too magic.
>>
>> Greg
>>
>
> I was looking for the logging framework used by the kernel developers.
> Not just the dmesg logs.
>
Most of its in kernel/printk.c and include/linux/printk.h
If you mean the API for the framework, it is most easily seen in the .h file:
http://lxr.linux.no/#linux+v2.6.38/include/linux/printk.h
For the guts, see vprintk in particular:
http://lxr.linux.no/#linux+v2.6.38/kernel/printk.c#L729
HTH
Greg
prev parent reply other threads:[~2011-03-25 18:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-22 17:13 kernel space logging Anand Arumugam
2011-03-23 9:42 ` sanjeev sharma
2011-03-25 17:47 ` Anand Arumugam
2011-03-25 17:59 ` Greg Freemyer
2011-03-24 21:47 ` Greg Freemyer
2011-03-25 17:43 ` Anand Arumugam
2011-03-25 17:50 ` Anuz Pratap Singh Tomar
2011-03-28 13:15 ` Anand Arumugam
2011-03-25 18:04 ` Greg Freemyer [this message]
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='AANLkTimxxq1MoFwrUOgzXXSw24qq04yi=5KKAZAaMAnx@mail.gmail.com' \
--to=greg.freemyer@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/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;
as well as URLs for NNTP newsgroup(s).