MultiFile

LogExpert

MultiFile

Most log file producing applications have a mechanism called "logfile rolling" or something like that. That means, if the logfile (e.g. logfile.txt) reaches a pre-defined file size, it will be renamed to logfile.txt.1 and a new logfile.txt will be created. If logfile.txt.1 already exists, it will be renamed to logfile.txt.2 and so on up to a pre-defined number of files. So you maybe have a history of logfiles with logfile.txt.9 (containing the oldest log entries), logfile.txt.8, logfile.txt.7 and so on up to to logfile.txt with the most recent log entries. The 9 ist only an example. It can be any number.

LogExpert can handle all this logfiles like one single large logfile. You you don't have to worry about, in which logfile you have to search something. It's like working with a single file.

Using MultiFile

For using MultiFile your files should follow the naming rule. That means if your most recent logfile is named "logfile.txt", the second most recent file must have the name "logfile.txt.1". The more less recent logfile is called "logfile.txt.2", and so on.

To enable MultiFile load the most recent logfile (e.g. logfile.txt) into LogExpert. Now choose 'MultiFile' from the File menu. LogExpert will now load all files following the naming rule for the currently loaded file. LogExpert tries to load files by adding the numbers 1, 2, 3... to the file name and stops as soon as a file with the resulting filename isn't found.

Navigating through MultiFiles

You can use all functions and all navigations in a loaded MultiFile. There's no difference to a normal file. When using MultiFile you can see the real filename of your current position in the status line. By using the Alt-Up and Alt-Down keys you can jump to the file boundaries.

The displayed line count is the sum of all lines in all loaded files. The file size display shows the file size of the most current file.

Rollover

If the application that produces your logfiles does a rollover (i.e. renaming all files by shifting the filenames) Logexpert will detect this situation. All internal file buffers will be shifted according to the new file names. If the oldest logfile gets lost (because your application reaches the logfile history limit) its content will be removed from the display.

Behind the scenes: File handling when using MultiFile

Just in case you're interested, here is how LogExpert handles the log files when MultiFile is enabled:

Imagine 3 logfiles: logfile.txt.2, logfile.txt.1 and logfile.txt. logfile.txt is the most current log file. It's the primary log file, feed by your application with new log entries.

Now you load logfile.txt and enable MultiFile. LogExpert will look for a file called "logfile.txt.1" and load it. Then it looks for "logfile.txt.2" and load it. Then it looks for "logfile.txt.3", does not find it and stop looking for more logfiles. All 3 log files will be displayed seamlessly in one window. LogExpert will watch "logfile.txt" for modifications and add the new log entries to the log window.

If logfile.txt reaches the size limit, your application starts to do a log file rollover:

 File

 renamed to

 logfile.txt.2

 logfile.txt.3

 logfile.txt.1

 logfile.txt.2

 logfile.txt

 logfile.txt.1

 <created anew>

 logfile.txt

LogExpert will detect that logfile.txt is created anew (because of the smaller file size). It checks, if there's a file logfile.txt.3 and if so, it checks if logfile.txt.3 has the same file size as logfile.txt.2 had before. If this is true, it will be assumed that logfile.txt.3 is the same file previously known as logfile.txt.2. The same procedure is done with logfile.txt.2 and logfile.txt.1.

Because the files are the same as before (but only with other names) there is no need to reload all files again. Only some internal file infos have to be adjusted (file buffers, bookmarks, filter search results etc.). The new created logfile.txt is loaded completely, of course. LogExpert will also start to load the old files completely, as soon as it cannot match the new files with the old ones. In most cases this will be logfile.txt.1, because it may contain content that was not read before by LogExpert.

Most applications have a limit for the logfile history. If (in our the example) the limit would be 4, there's no logfile.txt.4. The content of logfile.txt.3 will be lost, when a rollover occurs.

LogExpert can handle this situation. If LogExpert cannot find a renamed file for the oldest log file, its content will be removed from the internal file buffers (and from the log file display). This will almost result in changed line numbers. But all bookmarks and filter results will be adjusted. Bookmarks and filter results that are invalid now (because of the deleted log file) will be removed.