Skip to content

A small sample application that will continuously generate log files. Created for use with the Distributed Log Aggregator programming challenge.

Notifications You must be signed in to change notification settings

Insight-NA/log-file-generator

Repository files navigation

Log File Generator

A .NET console application that simulates multiple applications generating rolling log files with randomized timing and developer-themed messages. Perfect for testing log monitoring systems, storage solutions, or log analysis tools.

Download

From GitHub Releases

  1. Go to the Releases page
  2. Download the latest LoggerApplication.exe file
  3. The download is an executable LoggerApplication.exe and is ready to use

note that most operating systems will block the direct execution of downloaded files, so you may need to make the file executable via File Properties, or chmod +x command.

Direct Download URL

You can download the latest executable directly here: Insight-NA/log-file-generator/releases.

note that most operating systems will block the direct execution of downloaded files, so you may need to make the file executable via File Properties, or chmod +x command.

Using GitHub CLI

gh release download --repo Insight-NA/log-file-generator --pattern "LoggerApplication.zip"

Quick Start

  1. Create a params.txt file with your desired configurations (see below)
  2. Run the application:
    LoggerApplication.exe params.txt
  3. Press Ctrl+C to stop when done

Configuration File Format

The application uses a parameter file (default: params.txt) to configure multiple simulated applications. Each line represents one application logger.

Format

# Comment lines start with #
<avgMillisecondsBetweenLogs> <maxFileSizeMB> <logDirectory>

Parameters

  • avgMillisecondsBetweenLogs: Average milliseconds between log messages (randomized ±50%)
  • maxFileSizeMB: Maximum file size in MB before creating a new log file
  • logDirectory: Directory where logs will be written (created automatically if needed)

Example Configuration

# Fast logger - generates logs every ~100ms with 1MB file limit
100 1 ./logs/app1

# Medium logger - generates logs every ~200ms with 2MB file limit
200 2 ./logs/app2

# Slow logger - generates logs every ~500ms with 5MB file limit
500 5 ./logs/app3

Usage

With Default Parameter File

LoggerApplication.exe

This uses params.txt in the current directory.

With Custom Parameter File

LoggerApplication.exe myconfig.txt

Example: Testing Log Monitoring System

# Simulate three microservices
50 2 C:\Logs\WebAPI
100 5 C:\Logs\AuthService
200 10 C:\Logs\DataProcessor

Log Output

File Naming

Log files are named using the format: yyyyMMdd-HHmm.log

Example: 20251213-1430.log

If multiple files are created in the same minute, a suffix is added: 20251213-1430_1.log, 20251213-1430_2.log, etc.

Log Message Format

Each log entry follows this format:

yyyy-MM-dd HH:mm:ss.fff GUID Phrase1 Phrase2

Example:

2025-12-13 14:30:15.234 a1b2c3d4-e5f6-7890-abcd-ef1234567890 It works on my machine. Code never lies, comments sometimes do.

Console Output

Each simulated application prefixes its console output with its name:

[app1] 2025-12-13 14:30:15.234 ...
[app2] 2025-12-13 14:30:15.456 ...
[app3] 2025-12-13 14:30:15.789 ...

Log File Rollover

When a log file reaches the specified size limit, the application automatically:

  1. Closes the current file
  2. Creates a new file with an updated timestamp
  3. Continues logging to the new file

Stopping the Application

Press Ctrl+C to gracefully stop all loggers. The application will:

  • Stop generating new log messages
  • Close all open file handles
  • Display "Stopping loggers..." and "All loggers stopped."

System Requirements

  • Windows 10 or later (x64)
  • No additional dependencies required (self-contained executable)

Contributing

Interested in contributing? See CONTRIBUTING.md for development setup, testing, and how to submit pull requests.

License

This project is provided as-is for testing and demonstration purposes.

About

A small sample application that will continuously generate log files. Created for use with the Distributed Log Aggregator programming challenge.

Resources

Contributing

Stars

Watchers

Forks

Languages