Running the Samples

When learning to create custom filters and parsers for LogViewPlus it is helpful to begin with the sample code projects. There are four projects included in the sample code - a custom filter, custom parser, custom post processor and a custom reader. All of these implementations are kept intentionally simple. They serve an instructive rather than functional purpose.

The purpose of this tutorial is to get you up and running with the sample projects using Visual Studio.

To get started please download the sample projects and extract the zip file into a working directory. Open LogViewPlus_Samples.sln in Visual Studio. Once the solution is opened you should notice two projects: CustomFilter and CustomParser.

Before we build projects there's a few things we need to do. First open LogViewPlus and go to Settings -> Application -> Plugins and ensure that the "allow custom plugins" option is enabled.

This is a security feature. LogViewPlus will only check for extensions if the above configuration is applied. Once enabled please close all running instances of LogViewPlus.

Returning to Visual Studio there are a few things we need to check before we build our project.

First, we recommend replacing Clearcove.LogViewer.Common.dll and Clearcove.LogViewer.Common.xml with the file included with your LogViewPlus installation. A version of these files is included with the sample code to ensure the samples build correctly, but this version may be out of date. These files can be found in the installation directory %ProgramFiles%\LogViewPlus. They should replace the files in the "Libs" directory of the extracted sample code.

Next, for each project go to Properties -> Build Events. Both projects should have build events that copy the output of the build to the %AppData%\LogViewPlus\Plugins directory.

We also need to check that Properties -> Debug -> Start Action is set to run an external program. The plug-ins need to run inside of a LogViewPlus instance, so this should point to your LogViewPlus install directory.

Were now ready to build our solution. When you build the solution both of these projects will be built and the output would be saved to %AppData%\LogViewPlus\Plugins. This is the default directory where LogViewPlus expects plug-ins to be installed. When you run your project, Visual Studio will automatically start LogViewPlus in a debugger and you will be able to debug your plug-ins as expected.

Once LogViewPlus starts you will be able to confirm that your plug-ins are loaded successfully by going to Settings -> Application -> Plugins. Two plug-ins should be listed similar to the screenshot below.

Please see the following sections for more information on creating custom filters and custom parsers.

Microsoft .Net Versioning

Finally, note that LogViewPlus 2.5 and greater target .Net 4.7.2. Earlier versions target .Net 4.5.2.

The LogViewPlus Common library is required for all LogViewPlus plugins types. This library targets .Net 4.5.2. across all LogViewPlus versions to maintain backward compatibility. As discussed above, we always recommend using the Clearcove.LogViewer.Common.dll library that installs with LogViewPlus when building plugins.

The sample code referenced here was updated with the 2.5 release to target .Net 4.7.2. If you are targeting an earlier version of LogViewPlus, you will need to change the target framework.

< >