Stomp is a command-line utility that simply truncates, or clears, the contents of a file.
Originally written for use with a log file monitoring tool to clear log files during software development. Stomp ignores most exceptions. If a file is open by another program it may not be able to be stomped and the content will remain.
Stomp is written in C++. The project compiles using cmake in Windows with the MinGW toolchain and also in Linux with a standard toolchain. Binary executables are also available.
My favorite log monitoring/viewing program is SnakeTail http://snakenest.com/snaketail/.
Usage hint: Create a shortcut for stomp.exe with all the files you want stomped, e.g. program log, Tomcat log, etc., all on one command line.
The stomp utility is provided for free and “as is” with no guarantee or warranty expressed or implied. If you break it you own both parts.
Pass it around.
Binary executables are available for Windows, Fedora/CentOS/RedHat, and Debian/Ubuntu/Mint. Download at: https://github.com/Corionis/Stomp/wiki