Textpad as log file monitor
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Textpad as log file monitor
I'm using TextPad to monitor lots of log files. There are 3 little changes needed for this purpose:
1.) a command line argument that tells TextPad to immediately jump to the last line, after opening the file.
--> currently I always need to press Ctrl-End, for each file.
*edit*, better: I would like to configure this "jump to last line on open" for a document class.
2.) limit the AutoReload feature only to the current foreground file!
--> Currently, with many files loaded and all of them constantly changing, I get a flickering view and the wrong files pop into view from background.
3.) continue AutoReload when TextPad does not have the focus.
--> usually I use some other application to control my applications. I would like to see the results in the log files immediately, without clicking the TextPad window into foreground first.
And one more thing, "Nice to have": suspend AutoReload whenever the caret is not on the last line of the file. When I'm inspecting some error message in the log file, I don't want flickering changes in the view. As soon as I want the AutoReload/AutoScroll to resume, I would press Ctrl+End
What do you think? I posted this, convinced that these additions would make major improvements in the usability for many many users (system and web site administrators, software developers and testers, ...)
1.) a command line argument that tells TextPad to immediately jump to the last line, after opening the file.
--> currently I always need to press Ctrl-End, for each file.
*edit*, better: I would like to configure this "jump to last line on open" for a document class.
2.) limit the AutoReload feature only to the current foreground file!
--> Currently, with many files loaded and all of them constantly changing, I get a flickering view and the wrong files pop into view from background.
3.) continue AutoReload when TextPad does not have the focus.
--> usually I use some other application to control my applications. I would like to see the results in the log files immediately, without clicking the TextPad window into foreground first.
And one more thing, "Nice to have": suspend AutoReload whenever the caret is not on the last line of the file. When I'm inspecting some error message in the log file, I don't want flickering changes in the view. As soon as I want the AutoReload/AutoScroll to resume, I would press Ctrl+End
What do you think? I posted this, convinced that these additions would make major improvements in the usability for many many users (system and web site administrators, software developers and testers, ...)
Last edited by HooNose on Fri May 23, 2008 9:09 am, edited 2 times in total.
I agree these are useful features to have in a file that can open and view large text file. I would suggest that rather than a command line argument this should be tied into the existing syntax definitions available in TextPad. So if a file is type *.log or *.err or *.trace the documents opens as you suggest.
I used to use TextPad for this by jumping to the bottom line of the file and having TextPad automatically reload changed files. I did also use an application called BareTail for this but that was back in the day when it was free.
I used to use TextPad for this by jumping to the bottom line of the file and having TextPad automatically reload changed files. I did also use an application called BareTail for this but that was back in the day when it was free.
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
Well, having a command line switch that loaded a macro would provide a lot of flexibility also.
Almost any task could then be defined for any class.
That would be my second request after the ability to edit macros.
Editing macros is still number one need for me.
Almost any task could then be defined for any class.
That would be my second request after the ability to edit macros.
Editing macros is still number one need for me.
Hope this was helpful.............good luck,
Bob
Bob
That's already there. The menu entry File->Revert reloads the current file. You can easily define any keyboard shortcut for this command in Preferences/Keyboard/Category=File/Command=FileRevert.jonmcg wrote:I would like the option to manually reload files, ie only update when I want to. Preferably with a keyboard shortcut rather than having to open File
Re: Textpad as log file monitor
Hi. Textpad can do this, and the system is like in Notepad: if the first line of the file is .LOG (in capital letters, with the period, at first column), Textpad assumes it's a log, and jumps to the end, and inserts current date and time. This happens diregarding the extension of the file.HooNose wrote:1.) a command line argument that tells TextPad to immediately jump to the last line, after opening the file.
Perhaps you do not wish the date insertion?
Guillermo
Re: Textpad as log file monitor
That would not be useful for me because then the file is opened AND modified, which prevents the cool auto-reload feature, after my external applications write new log entries into the file.abramson wrote: Perhaps you do not wish the date insertion?
Guillermo
-
- Posts: 59
- Joined: Fri Apr 18, 2008 3:25 am
See Help -> Help Topics -> Index -> command -> Display -> Command Line Parameters -> Display -> "Command Line Parameters" -> "Notes"
Note the presented example: TEXTPAD.EXE -ac "Read me.txt"(51,20)
Then consider this:
What might happen if the line argument supplied in the cursor coordinates is larger than the largest-possible log-file line number? Error? Or will TextPad just open to the last line of the log file?
Example:
textpad.exe -am "filename.log"(9999999999,1)
Edit:
And might some creative arrangement involving a second instance give you an improved situation with respect to the flickering problem?
I'm trying to feed you with ideas that might help you to come up with one of your own that might eventually lead you to a solution. . . .
Note the presented example: TEXTPAD.EXE -ac "Read me.txt"(51,20)
Then consider this:
What might happen if the line argument supplied in the cursor coordinates is larger than the largest-possible log-file line number? Error? Or will TextPad just open to the last line of the log file?
Example:
textpad.exe -am "filename.log"(9999999999,1)
Edit:
And might some creative arrangement involving a second instance give you an improved situation with respect to the flickering problem?
I'm trying to feed you with ideas that might help you to come up with one of your own that might eventually lead you to a solution. . . .
I came in on 4.5 in 2001, moved to 4.7.2 in 2004, moved to 4.7.3 in 2007, moved to 5.4 in 2010, and am excited about 2013. I've said it many times before, and I'll say it many times again: "I love this program."
Thanks for your help with ideas.
As for the many TextPad-Windows and flickering problem, let me describe my scenario:
I am developing fab automation software and I have say 100 log files open, 1 for each equipment in the fab. I would not like to manage 100 TextPad windows. But I very much like to use the tabbed document selector to switch to a certain equipment log. And when I switch to it, I want to see only updates for this log file, not for the others.
Frank
This is not so bad. And it works - I just tested it. But. I usually define document classes, like "LogFile"=*.log, and assign file type associations for TextPad, so I can double click the files in explorer. I don't think I can define this (#line,#pos) argument for a document class on opening, can I.HerNameWasTextPad wrote: textpad.exe -am "filename.log"(9999999999,1)
As for the many TextPad-Windows and flickering problem, let me describe my scenario:
I am developing fab automation software and I have say 100 log files open, 1 for each equipment in the fab. I would not like to manage 100 TextPad windows. But I very much like to use the tabbed document selector to switch to a certain equipment log. And when I switch to it, I want to see only updates for this log file, not for the others.
Frank
-
- Posts: 59
- Joined: Fri Apr 18, 2008 3:25 am
Edit: Much of this particular post should be ignored, as much of it is wrong. Please see my next post, which makes more sense, at some point below.
I'm envisioning two instances of TextPad: one to hold all of the open files for the purpose of allowing the Auto-Reload feature, and one to hold just the one file that you want to view without flickering.
This would mean that you would have to enter (paste?) the appropriate command at the command line in order to launch a second instance of the file (-m for second instance?). The one file to view would simultaneously be open, and getting Auto-Reloaded, in the first instance.
Maybe it would be more convenient to launch and manage just the second instance without the command line?
When a single file in a separate instance is Auto-Reloaded, does it stay at its current cursor position or return to line 1? Well, you could manually turn off the Auto-Reload feature in the second instance and manually "Revert" when you're ready. . . .
Thinking about these possibilities might allow you to determine a new, more streamlined way in which to work, even if it means giving up something familiar, such as the use of the document-centric approach to launch files from Explorer.
See these recent posts. They're related to the cursor trick, involve batch files as tools that can utilize Tool Parameter Macros, and might offer some ideas:
http://forums.textpad.com/viewtopic.php ... ght=#31470
http://forums.textpad.com/viewtopic.php ... ght=#31476
By the way, wouldn't using the Document Selector be somewhat better for the manipulation of 100 open files instead of using Document Tabs?
I'm envisioning two instances of TextPad: one to hold all of the open files for the purpose of allowing the Auto-Reload feature, and one to hold just the one file that you want to view without flickering.
This would mean that you would have to enter (paste?) the appropriate command at the command line in order to launch a second instance of the file (-m for second instance?). The one file to view would simultaneously be open, and getting Auto-Reloaded, in the first instance.
Maybe it would be more convenient to launch and manage just the second instance without the command line?
When a single file in a separate instance is Auto-Reloaded, does it stay at its current cursor position or return to line 1? Well, you could manually turn off the Auto-Reload feature in the second instance and manually "Revert" when you're ready. . . .
Thinking about these possibilities might allow you to determine a new, more streamlined way in which to work, even if it means giving up something familiar, such as the use of the document-centric approach to launch files from Explorer.
See these recent posts. They're related to the cursor trick, involve batch files as tools that can utilize Tool Parameter Macros, and might offer some ideas:
http://forums.textpad.com/viewtopic.php ... ght=#31470
http://forums.textpad.com/viewtopic.php ... ght=#31476
By the way, wouldn't using the Document Selector be somewhat better for the manipulation of 100 open files instead of using Document Tabs?
Last edited by HerNameWasTextPad on Sat May 24, 2008 6:01 am, edited 1 time in total.
I came in on 4.5 in 2001, moved to 4.7.2 in 2004, moved to 4.7.3 in 2007, moved to 5.4 in 2010, and am excited about 2013. I've said it many times before, and I'll say it many times again: "I love this program."
Yes indeed. And I'm actually doing it this way sometimes. Just didn't want to overly emphasize the irrelevant details. But, now that you're talking of it: For log files, the document selector takes too much space on the side. All log file lines start with a time stamp, process- and thread-ID and other markers before the intresting information. Hence i need all the available width for the text client area :@)HerNameWasTextPad wrote: By the way, wouldn't using the Document Selector be somewhat better for the manipulation of 100 open files instead of using Document Tabs?
-
- Posts: 59
- Joined: Fri Apr 18, 2008 3:25 am
Great news!
First, in retrospect, I now realize that I got most of it wrong in my previous post. I must have been tired. Sorry.
Second, I just discovered that TextPad's Revert command reloads a file without changing the screen's view or the position of the cursor. ("I love this program.")
This ultimately brings us to the following conclusions.
Your best course of action might be as follows. Note that I have not yet tested this course of action:
- As much as you would hate to do this, do it: Configure -> Preferences -> File -> When files are modified by another process -> Ignore
- Map a convenient key to the Revert command, such as Alt+R, which, by default, is available
- Create a text file of all of the names of the log files that you will need to open, one per line, e.g., "FileNameX.log"(9999999999,1) per line, so that you will be able to utilize both the @filename command-line parameter and cursor-positioning arguments when launching all of the log files in a single instance of TextPad, using just a single command-line command. See "Command Line Parameters" in the Help facility
- Close TextPad
- At the command line, at the appropriate directory, type "textpad.exe @filename" (without the quotes), where filename is the name of the text file that contains the names of the 100 or so log files you want to open
- Once the instance is open (I imagine it would take a few seconds for 100 or so files to open), each file should be open with the cursor at the bottom, so you won't have to Ctrl+End; there should be no more flickering, because Auto-Reload will be off; and you can use the Document Selector to navigate to any file with just one click, and Alt+R to reload any file before you view it
Would this be an improvement over your current situation?
You can quickly and easily create the file of filenames by selecting bunches of files using TextPad's Open dialog box, copying the string of filenames that shows up in the "File name:" text box, and using the Replace... command to change each set of quote marks between the filenames to a newline character (i.e., \n).
By the way, what about floating the Document Selector to get it out of the way and maximize your view?
First, in retrospect, I now realize that I got most of it wrong in my previous post. I must have been tired. Sorry.
Second, I just discovered that TextPad's Revert command reloads a file without changing the screen's view or the position of the cursor. ("I love this program.")
This ultimately brings us to the following conclusions.
Your best course of action might be as follows. Note that I have not yet tested this course of action:
- As much as you would hate to do this, do it: Configure -> Preferences -> File -> When files are modified by another process -> Ignore
- Map a convenient key to the Revert command, such as Alt+R, which, by default, is available
- Create a text file of all of the names of the log files that you will need to open, one per line, e.g., "FileNameX.log"(9999999999,1) per line, so that you will be able to utilize both the @filename command-line parameter and cursor-positioning arguments when launching all of the log files in a single instance of TextPad, using just a single command-line command. See "Command Line Parameters" in the Help facility
- Close TextPad
- At the command line, at the appropriate directory, type "textpad.exe @filename" (without the quotes), where filename is the name of the text file that contains the names of the 100 or so log files you want to open
- Once the instance is open (I imagine it would take a few seconds for 100 or so files to open), each file should be open with the cursor at the bottom, so you won't have to Ctrl+End; there should be no more flickering, because Auto-Reload will be off; and you can use the Document Selector to navigate to any file with just one click, and Alt+R to reload any file before you view it
Would this be an improvement over your current situation?
You can quickly and easily create the file of filenames by selecting bunches of files using TextPad's Open dialog box, copying the string of filenames that shows up in the "File name:" text box, and using the Replace... command to change each set of quote marks between the filenames to a newline character (i.e., \n).
By the way, what about floating the Document Selector to get it out of the way and maximize your view?
I came in on 4.5 in 2001, moved to 4.7.2 in 2004, moved to 4.7.3 in 2007, moved to 5.4 in 2010, and am excited about 2013. I've said it many times before, and I'll say it many times again: "I love this program."
Sure you can. Edit the file association in your registry.HooNose wrote:I usually define document classes, like "LogFile"=*.log, and assign file type associations for TextPad, so I can double click the files in explorer. I don't think I can define this (#line,#pos) argument for a document class on opening, can I.HerNameWasTextPad wrote:textpad.exe -am "filename.log"(9999999999,1)
Or edit the following to reflect you local TextPad path and save it as a file called temp.reg. Double-click to merge with your registry.
Code: Select all
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.log]
@="TextPad.log"
[HKEY_CLASSES_ROOT\TextPad.log\shell\open\command]
@="C:\\Program Files\\TextPad\\TextPad.exe -am "%1"(9999999999,1)"
[-HKEY_CLASSES_ROOT\TextPad.log\shell\open\ddeexec]
I like the general idea of this enhancement. It would basically be a very nice version of the Unix tail command with the --follow option.
I think the best way to implement it would be to add some new options to the preferences for file reloads. One option would allow users to specify that "When files are modified by another process", if the reload mode is prompt or auto, TextPad would ignore the reload if there are unsaved edits [IgnoreReloadIfEdited]. (Currently it prompts.) I would implement this in the Preferences dialog by adding a checkbox before the current checkboxes to "Ignore differences if the file has been edited in TextPad".
Another new option would determine how the cursor was positioned, either maintain the current position, move to the end of the file, or move to then beginning of the file. I would implement this in the GUI as a radio button, for example:
Or if vertical screen real estate is expensive:
Another feature would need to be added that let you reload a file on demand. This is different than the existing revert command. This command would care about whether or not the new IgnoreReloadIfEdited preference was set. Revert would continue to work as it does, i.e. reloading the file regardless of the new preference.
There would need to be new keyboard commands:
I think the best way to implement it would be to add some new options to the preferences for file reloads. One option would allow users to specify that "When files are modified by another process", if the reload mode is prompt or auto, TextPad would ignore the reload if there are unsaved edits [IgnoreReloadIfEdited]. (Currently it prompts.) I would implement this in the Preferences dialog by adding a checkbox before the current checkboxes to "Ignore differences if the file has been edited in TextPad".
Another new option would determine how the cursor was positioned, either maintain the current position, move to the end of the file, or move to then beginning of the file. I would implement this in the GUI as a radio button, for example:
Code: Select all
Cursor positioning on reloads:
x Do not change cursor position
o Move cursor to the end of the file
o Move cursor to the beginning of the file
Code: Select all
Cursor positioning on reloads:
x Don't change o End of file o Beginning of file
There would need to be new keyboard commands:
- * commands to control the file reload mode FileReloadModePrompt, FileReloadModeAuto, and FileReloadModeIgnore
- * commands to toggle the IgnoreReloadIfEdited preference: IgnoreReloadIfEditedOn, IgnoreReloadIfEditedOff, and IgnoreReloadIfEditedToggle
- * commands to control the reload cursor positioning behavior: ReloadPositionSame, ReloadPositionEnd, and ReloadPositionStart
- * a command that toggles between the all the current settings and a "follow tail" mode, i.e. one command that temporarily sets FileReloadModeAuto and ReloadPositionEnd, but can toggle back: ToggleFollowTail. Also, this would not effect the IgnoreReloadIfEdited preference.
- * a command that toggles between the all the current settings and a "follow head" mode, i.e. one command that temporarily sets FileReloadModeAuto and ReloadPositionStart, but can toggle back: ToggleFollowHead. (Again, this would not effect the IgnoreReloadIfEdited preference.)