Scrolling log files

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I got a log file I'd like to scroll on the screen as new entries are added
to the bottom. So far, I've written a little code that grabs the last X
lines from the file and displays them in a < textarea >. The user hits
"refresh" to see more recent entries.

The trouble is that I can't get the textarea to scroll to the bottom so the
most recent entries are visible.

1. Is there a way to get textarea elements to automatically put the cursor
at the bottom?
2. More generally, is there a better way to do this user interface?

Re: Scrolling log files

Chris wrote:

Quoted text here. Click to load it

I assume you use some server side coding to do that too, so why not toss
your output from the script into an array and reverse that array?
Then you output the reversed array and the newest entries of your logfiles
will always be at the top of the textarea.

Registeret Linux user #292411

Site Timeline