{"record":{"id":"72630f1fa4fbc3b9","repo":"apache/cassandra","slug":"log-interval-must-be-greater-than-zero","errorCode":null,"errorMessage":"Log interval must be greater than zero","messagePattern":"Log interval must be greater than zero","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/SettingsLog.java","lineNumber":73,"sourceCode":"        noSettings = options.noSettings.setByUser();\n\n        if (options.outputFile.setByUser())\n            file = new File(options.outputFile.value());\n        else\n            file = null;\n        if (options.hdrOutputFile.setByUser())\n            hdrFile = new File(options.hdrOutputFile.value());\n        else\n            hdrFile = null;\n        String interval = options.interval.value();\n        if (interval.endsWith(\"ms\"))\n            intervalMillis = Integer.parseInt(interval.substring(0, interval.length() - 2));\n        else if (interval.endsWith(\"s\"))\n            intervalMillis = 1000 * Integer.parseInt(interval.substring(0, interval.length() - 1));\n        else\n            intervalMillis = 1000 * Integer.parseInt(interval);\n        if (intervalMillis <= 0)\n            throw new IllegalArgumentException(\"Log interval must be greater than zero\");\n        level = Level.valueOf(toUpperCaseLocalized(options.level.value()));\n    }\n\n    public MultiResultLogger getOutput() throws FileNotFoundException\n    {\n        // Always print to stdout regardless of whether we're graphing or not\n        MultiResultLogger stream = new MultiResultLogger(new PrintStream(System.out));\n\n        if (file != null)\n            stream.addStream(new PrintStream(file));\n\n        return stream;\n    }\n\n    // Option Declarations\n\n    public static final class Options extends GroupedOptions\n    {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/SettingsLog.java#L55-L91","documentation":"cassandra-stress parses the -log interval option (e.g. '10ms', '5s' or a bare seconds value) into milliseconds and refuses non-positive values. IllegalArgumentException is thrown from the SettingsLog constructor because a zero or negative interval would disable or invert periodic logging of progress.","triggerScenarios":"Running cassandra-stress with '-log interval=0', 'interval=-5s', or any interval that parses to <=0 milliseconds (e.g. 'interval=0s').","commonSituations":"Copy-pasted stress configs where the interval was blanked to 0 to 'disable' logging; scripted invocations computing interval from a variable that evaluated to 0.","solutions":["Pass a positive interval, e.g. -log interval=10s","Check the unit suffix: bare values are seconds, 'ms' is milliseconds; ensure the number is >0","If you want no periodic logging, omit the interval option entirely instead of setting it to 0"],"exampleFix":"// before\ncassandra-stress write -log interval=0s\n// after\ncassandra-stress write -log interval=10s","handlingStrategy":"validation","validationCode":"int millis = parseIntervalMillis(args.value(\"interval\"));\nif (args.containsKey(\"interval\") && millis <= 0)\n    throw new IllegalArgumentException(\"interval must be > 0, e.g. 10s\");","typeGuard":null,"tryCatchPattern":"try { SettingsLog.get(clArgs); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Log interval\")) { /* correct -log interval and retry */ } else throw e; }","preventionTips":["Never set interval to 0 to disable logging; omit the option instead","Sanity-check computed intervals in scripts (non-zero, positive)","Remember bare interval values are seconds, 'ms' is milliseconds"],"tags":["cli","config","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}