summaryrefslogtreecommitdiff
path: root/src/main/java/testing/TestVerboseLogging.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-21 20:34:33 +0300
committerPaul Buetow <paul@buetow.org>2025-06-21 20:34:33 +0300
commitce82046a11521b0537ac2150a07a4de54aec883a (patch)
tree73b420d63f6eadc006a75f7129ebe04762721c3f /src/main/java/testing/TestVerboseLogging.java
parentf0e31d4de0c8e206260467420257a6f04ffc8e90 (diff)
Improve verbose logging for protocol tests
- Enable real-time log output during simulation execution - Fix HeadlessProtocolRunner to properly show logs as they happen - Update LogCapture to format timestamps clearly - Add test-verbose.sh script for demonstrating logging - Remove duplicate log printing in verbose mode Now when running tests with -Dds.sim.verbose=true or option 3 in test-protocols.sh, users can see protocol actions as they occur. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'src/main/java/testing/TestVerboseLogging.java')
-rw-r--r--src/main/java/testing/TestVerboseLogging.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/testing/TestVerboseLogging.java b/src/main/java/testing/TestVerboseLogging.java
new file mode 100644
index 0000000..9833d84
--- /dev/null
+++ b/src/main/java/testing/TestVerboseLogging.java
@@ -0,0 +1,27 @@
+package testing;
+
+/**
+ * Simple test to demonstrate verbose logging during simulation.
+ */
+public class TestVerboseLogging {
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("=== Testing Verbose Logging ===\n");
+
+ // Run a short simulation with verbose logging
+ HeadlessSimulationRunner runner = new HeadlessSimulationRunner();
+ runner.setPrintLogs(true); // Enable real-time log output
+
+ System.out.println("Starting simulation with real-time log output...\n");
+
+ try {
+ SimulationResult result = runner.runSimulation("saved-simulations/ping-pong.dat", 1000);
+
+ System.out.println("\n=== Simulation Complete ===");
+ System.out.println("Total logs captured: " + result.getAllLogs().size());
+ System.out.println("Processes: " + result.getMetrics().getNumProcesses());
+ } finally {
+ runner.shutdown();
+ }
+ }
+} \ No newline at end of file