@Test
    public void testRaceCondition () throws FileNotFoundException {
        int numThreads = 10;
        Thread[] t = new Thread[numThreads];
        final CyclicBarrier barrier = new CyclicBarrier(numThreads);
        final int numLogEntries = 100;

        try {
            final VespaLogHandler h =
                new VespaLogHandler(new FileLogTarget(new File("test4")),
                        new VespaLevelControllerRepo("my-test-config-id.logcontrol", "all", "TST"), "my-test-config-id",
                                    "TST"
                );

            class LogRacer implements Runnable {

                private LogRacer() {
                }

                public void run () {
                    try {
                        barrier.await();
                        logLikeCrazy();
                    }
                    catch (BrokenBarrierException | InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }

                void logLikeCrazy() {
                    for (int j = 0; j < numLogEntries; j++) {
                        try {
                            h.publish(record1);
                            h.publish(record2);
                        }
                        catch (Throwable t) {
                            fail(t.getMessage());
                        }
                    }
                }
            }

            for (int i = 0; i < numThreads; i++) {
                t[i] = new Thread(new LogRacer());
                t[i].start();
            }

            for (int i = 0; i < numThreads; i++) {
                t[i].join();
            }

            String[] lines = readFile("test4");
            assertTrue("num lines was " + lines.length
                       + " should be " +  (2 * numLogEntries * numThreads),
                       (lines.length == (2 * numLogEntries * numThreads)));

            h.cleanup();
            h.close();
        }
        catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        finally {
            new File("test4").delete();
        }

    }
This test was made in order to look for a race condition
which occurs when file rotation in the VespaLogHandler
occurs concurrently (which it should never do).
vespalog/src/test/java/com/yahoo/log/VespaLogHandlerTestCase.java