March 12th, 2015
When developing for Kentico, the event log can provide helpful debugging information. Keeping an eye on it can mean constantly refreshing the page. There is a better way to do this, which can be done by enabling Kentico’s ability to put items in the event log into a file, giving us access to a much wider range of tools for monitoring the log.
The first step is to verify that Kentico is configured to save the event log to the file system. This can be done by going into the Admin page, and going into
Settings > System. Inside the
Event Log section, make sure that the
Event log size setting is set to something above 0 (by default it is 1,000). You will also need to enable the
Log to filesystem setting. You can see what this should look like on the screenshot below.
This will ensure that the event log is being written out to
App_Data/logEvents.log. There are a number of different options that can be used to monitor the log.
Tail for Win32 is a GUI version of the UNIX
tail -f command built for Windows. This command monitors a file for changes, and prints out the changed lines.
tail is a command line UNIX program which does exactly the same thing. on Mac or Linux systems, this program is already built in, but on Windows it takes a little bit more work to get it to run.
Configuring ConsoleZ with SourceTree
Once ConsoleZ has been downloaded, we need to configure it to use a bash environment. There are a number of ways to get a bash environment in Windows, including Cygwin and MSYS. I went a slightly simpler rout. SourceTree comes with a built in version of git, which includes a limited bash shell. Since I already have SourceTree installed and configured on my system, ConsoleZ can be configured to load this environment by default.
Open up the settings, and configure the Shell to be located at:
C:\Users\<username>\AppData\Local\Atlassian\SourceTree\git_local\git-bash.bat. You can see the proper settings in the screenshot below.
Once the shell has been set for ConsoleZ, you will need to open a new tab in ConsoleZ for it to load the proper environment. Then all it takes to load up tail is to run the following command:
tail -f Path-To-Kentico-Project/App_Data/logEvents.log
This will give you real-time monitoring for the Kentico event log while you are developing.