LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   capturing console (/dev/ttyS1) logs (https://www.linuxquestions.org/questions/linux-newbie-8/capturing-console-dev-ttys1-logs-943021/)

xerox 05-03-2012 12:10 AM

capturing console (/dev/ttyS1) logs
 
Hi,

I have been trying to capture console logs from the init script.
When the ramfs is mounted, i check if usb is connected , if conncted, i mount it and redirected the console logs like so:

Code:

cat & /dev/ttyS1 >> /mnt/logs.txt
I'm getting

Code:

/bin/sh : /dev/ttyS1 :permission denied
I tried changing the permission to 777, but to no avail.
I also tried sudo, and found out that our ramfs does not support this command.
The console logs are still being printed on the monitor.

Please suggest a solution.

Thanks.

catkin 05-04-2012 08:48 AM

Does your distro have a boot logging facility such as bootlogd?

xerox 05-08-2012 04:52 AM

This is on an embedded device, and these logs come from ramfs.

catkin 05-08-2012 06:34 AM

Quote:

Originally Posted by xerox (Post 4669036)
Code:

cat & /dev/ttyS1 >> /mnt/logs.txt

Sorry -- I don't have a solution but doesn't that command (those two commands) means "run cat in the background" followed by "execute /dev/ttyS1 and append the output to /mnt/logs.txt"?

AFAIK from studying bootlogd source code too long ago for memory to serve well, intercepting writes to the console is non-trivial. I had a look for the bootlogd source code to refresh memory but could not find it.

xerox 05-08-2012 06:45 AM

Thank you the speedy response and your precious time.

Quote:

doesn't that command (those two commands) means "run cat in the background" followed by "execute /dev/ttyS1 and append the output to /mnt/logs.txt"?
That is my intention, but nothing is happening when i do this. When i try from command line:

Code:

cat /dev/ttyS1 >> sample.txt
It hangs...

Also in our ramfs, we are printing logs to screen using DEBUG1L(); function.
Capturing this is my ultimate aim.

Also any suggestion to diagnose this problem better is welcome.

catkin 05-08-2012 06:52 AM

Quote:

Originally Posted by xerox (Post 4673283)
Thank you the speedy response and your precious time.

Will this make any difference?

Code:

cat /dev/ttyS1 >> /mnt/logs.txt &
I believe i have tried this as well, i'll try once more.

Better but unlikely to work because you want to capture writes to /dev/ttyS1, not output from it (whatever that means -- AFAIK the keyboard input goes via a complex route through the kernel).

Ideas for a solution could come from the bootlogd source code .. but where is it?!


All times are GMT -5. The time now is 09:02 AM.