Results 1 to 8 of 8
Hi,
This is my first post in this forum.
I am currently working with Device driver where in i need to move some of my debug messages to /var/log/messages.
Can ...
- 02-04-2009 #1Just Joined!
- Join Date
- Feb 2009
- Location
- Chennai, India
- Posts
- 28
How to use logs under Device driver
Hi,
This is my first post in this forum.
I am currently working with Device driver where in i need to move some of my debug messages to /var/log/messages.
Can i use syslog function call under Device driver for this one?
I forgot to mention. I need to move the debug messages to /var/log/messages only i don't want them to be printed on the stdout(i.e.,)console
- Bala C-Last edited by cbalu; 02-04-2009 at 02:10 PM. Reason: Missed full context
- 02-04-2009 #2
Is your device driver a kernel module? If it is then use printk...Hope this Helps...Gerard4143
Welcome to the forums
- 02-05-2009 #3Just Joined!
- Join Date
- Feb 2009
- Location
- Chennai, India
- Posts
- 28
Its a I2C device driver for a custom hardware which is a kernel module only.
If i am correct, using the printk function will make the debug message print in the console also. But, i am looking for a different solution wherein i need to print Driver Init and Exit messages only to the console and move rest of my debug messages under driver to /var/log/messages
- 02-05-2009 #4
Check out this link...especially the section "replacing printks"
The Linux Kernel Module Programming Guide
Hope this helps...Gerard4143
- 02-05-2009 #5Just Joined!
- Join Date
- Feb 2009
- Location
- Chennai, India
- Posts
- 28
Gerard4143 thanks for your reply.
But, i don't need this one.
Just to make things clear.Can i use syslog() function call inside driver.
- 02-05-2009 #6
- 02-05-2009 #7Just Joined!
- Join Date
- Feb 2009
- Location
- Chennai, India
- Posts
- 28
It is a kernel module only.
So i can't use syslog() function for this one.
Is there any other way.
I will explain my problem fully.
I have a linux device driver(kernal module) for a custom hardware. In which i have printk statements inside module_init and module_exit functions which i need to show up in the console itself. But,when using the driver i have so many debug printk statements which i don't want to show up in the console.
Instead move those messages to /var/log/messages so that while debugging the driver it will be usefull.
- 02-06-2009 #8Just Joined!
- Join Date
- Feb 2009
- Location
- Chennai, India
- Posts
- 28
Finally i found the solution which i was looking for about 2 days.
I am posting the link for others reference
This is the link


Reply With Quote
