LogShark was created because of the need for a simple log monitor which can be kept running while building and running your applications.
LogShark can monitor multiple directories simultaneously and per directory you can specify which files it should open. The files to open are specified using patterns, making it possible to monitor files with changing names and/or monitoring files with names containing the current date.
LogShark does not lock any directories or files allowing you to remove the directories and files if needed (e.g. when doing a clean build).
LogShark shows all logs in one window with a tab for each file. If a file (matching a pattern) is created a new tab is added. You can specify whether and when tabs should be closed. By default tabs are closed if the file no longer exists.
LogShark can be downloaded from the file list of the project at SourceForge.net.
LogShark is available in the following languages:
More translations are very welcome. Translating LogShark is very easy, less than 30 texts have to be
translated. If you want to translate LogShark, check out the source code and create properties files for your
language in Java package
net.sf.logshark.simple. After you have finished translating add an issue to
the issue tracker attaching the translations.
Translations of this manual are welcome too. After you translated the manual, add an issue to the issue tracker attaching the translation.
Let's start LogShark with the following configuration file:
# LogShark configuration for MyServer instance at C:\MyServer-1.03 # The directory containing the server logs C:\MyServer-1.03\logs # Today's request log - request-:year:-:month-lz:-:day-lz:\.log # The directory containing the logs for the Foo application C:\MyServer-1.03\apps\Foo\logs # The Foo application clears its log on every restart and puts the # time in the filename. Regular expression are used to match any # file with a certain prefix # The lines of these files will be wrapped = foo-errors-.+\.log # The directory containing the logs for the Bar application C:\MyServer-1.03\apps\Bar\logs # The Bar application uses a log with a fixed name - bar-application\.log
For other platforms than Windows, please adjust the directory paths before starting LogShark:
java -jar logshark.jar <configuration file>
If you start LogShark without arguments (by using the command line or by double-clicking on its JAR file) a dialog will open showing you the recently used configurations. You can also open another configuration file by using the browse button of this dialog.
The following window should appear:
The window contains the following components:
Each directory is prefixed by a number. These numbers are also used to prefix the filenames shown on the tabs. This way you can easily see in which directory a file resides.
The fat dash after the directories indicates that the directories do not exist. This is useful because it allows you to spot configuration errors quickly.
Let's create the directory
C:\MyServer-1.03\logs. The window changes to:
The fat dash of the first directory has changed to a fat dot. This dot indicates that the directory exists.
Using your favorite editor create a file called
Nothing happens now because the filename does not match the pattern specified in the configuration.
Now create a file
request-yyyy-mm-dd.log using yesterday's date. Again
nothing happens. Create another file but now use today's date. The last file matches the pattern, and LogShark
reads the file and shows it in a new tab:
The label of the tab shows the following information. Using this information you can identify each log file and can skip over files without information:
Create another file, this time in
C:\MyServer-1.03\apps\Foo\logs, and call it
foo-errors-yyyy-mm-dd_hh.mm.log using the current date and time.
The LogShark window changes to:
Keep the tab with the error log of the Foo application on top and change the request log of the server:
Because the file changed but its tab is not the active one, LogShark adds an indicator to its tab so you know that the file has changed.
Now delete the error log of the Foo application and the
logs directory of the Foo
application. The tab for the file will be closed by LogShark and the dot behind the directory will change into a
If you right-click on the remaining tab a menu with the following items will appear.
The clear item will erase the current tab. LogShark remembers which lines were erased and will not show them again when the file changes.
The clear all item erases all the tabs. This is useful if you only want to see the log entries which are the result of executing a command.
To copy the contents of a tab to the clipboard invoke the copy command.
With copy file location you copy the full path of the log file displayed on the current tab to the clipboard.
The close item closes the tab for this session of LogShark. When the associated file is updated or recreated the tab will not reopen.
If you want to close all tabs except the current one, use the close other tabs item.
The chapter above only shows the basic possibilities of LogShark. There are many options to customize its behavior including but not limited to:
See the configuration reference for information about all the available options.
LogShark can use quite a bit of memory. If you open a lot and/or big log files LogShark may fail with an out-of-memory exception. If you run into this problem you can increase the maximum amount of memory LogShark may use. For example, set it to 192 MB:
java -Xmx192M -jar logshark.jar <configuration file>
There are known problems with some graphics cards. If your LogShark window is not updated correctly, please set
the system property
true. For example:
java -Dsun.java2d.noddraw=true -jar logshark.jar <configuration file>
Visit the project page of LogShark at SourceForge.net: