{"record":{"id":"ec7b30cd427debc8","repo":"pentaho/pentaho-kettle","slug":"central-log-store-is-not-initialized","errorCode":null,"errorMessage":"Central Log Store is not initialized!!!","messagePattern":"Central Log Store is not initialized!!!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"core/src/main/java/org/pentaho/di/core/logging/KettleLogStore.java","lineNumber":172,"sourceCode":"   *          the maximum size of the log buffer\n   * @param maxLogTimeoutMinutes\n   *          The maximum time that a log line times out in minutes\n   */\n  private static synchronized void init0( int maxSize, int maxLogTimeoutMinutes, boolean redirectStdOut,\n    boolean redirectStdErr ) {\n    if ( store != null ) {\n      // CentralLogStore already initialized. Just update the values.\n      store.appender.setMaxNrLines( maxSize );\n      store.replaceLogCleaner( maxLogTimeoutMinutes );\n    } else {\n      store = new KettleLogStore( maxSize, maxLogTimeoutMinutes, redirectStdOut, redirectStdErr );\n    }\n    initialized.set( true );\n  }\n\n  public static KettleLogStore getInstance() {\n    if ( store == null ) {\n      throw new RuntimeException( \"Central Log Store is not initialized!!!\" );\n    }\n    return store;\n  }\n\n  /**\n   * @return the number (sequence, 1..N) of the last log line. If no records are present in the buffer, 0 is returned.\n   */\n  public static int getLastBufferLineNr() {\n    return getInstance().appender.getLastBufferLineNr();\n  }\n\n  /**\n   *\n   * Get all the log lines pertaining to the specified parent log channel id (including all children)\n   *\n   * @param parentLogChannelId\n   *          the parent log channel ID to grab\n   * @param includeGeneral","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/logging/KettleLogStore.java#L154-L190","documentation":"KettleLogStore.getInstance() returns the central log store singleton, but only after KettleLogStore.init() has been called. If the static store is still null, the store was never initialized and a RuntimeException is thrown. All log-buffer accessors (getLastBufferLineNr, getAppender, etc.) route through this, so any logging API use before init fails.","triggerScenarios":"Calling KettleLogStore.getLastBufferLineNr/getLogBufferFromTo/getAppender/bufferAppender or getInstance() itself without first calling KettleLogStore.init() in the current JVM — typical in embedded usage, unit tests, or standalone tools that skip KettleEnvironment.init().","commonSituations":"Embedding Kettle APIs in a custom app without initializing the environment; running a JUnit test that touches the log buffer; calling logging APIs from a shutdown hook or separate thread before initialization completes.","solutions":["Call KettleLogStore.init() (or KettleEnvironment.init(), which does it) once at application startup before using any logging APIs.","In tests, add initialization in @BeforeClass / setup.","Guard late/lazy paths so no logging call executes before init finishes.","Check that an earlier init failure (exception swallowed elsewhere) didn't leave the store uninitialized."],"exampleFix":"// before\nint nr = KettleLogStore.getLastBufferLineNr(); // store not initialized\n// after\nKettleLogStore.init();\nint nr = KettleLogStore.getLastBufferLineNr();","handlingStrategy":"validation","validationCode":"if (KettleLogStore.getInstance() == null) { /* would throw */ }\n// Pre-check instead: ensure init happened at startup\nKettleEnvironment.init(); // performs KettleLogStore.init() internally","typeGuard":"static boolean isLogStoreReady() {\n  try { KettleLogStore.getInstance(); return true; }\n  catch (RuntimeException e) { return false; }\n}","tryCatchPattern":"try {\n  int nr = KettleLogStore.getLastBufferLineNr();\n} catch (RuntimeException e) {\n  KettleLogStore.init();\n  int nr = KettleLogStore.getLastBufferLineNr();\n}","preventionTips":["Always call KettleEnvironment.init() (or KettleLogStore.init()) before any logging API in embedded usage.","Initialize once at application startup, before any transformations/jobs run.","In tests, initialize in @BeforeClass.","Avoid touching log-buffer APIs from early bootstrap or shutdown-hook code."],"tags":["kettle","logging","initialization","singleton"],"backgroundTag":"missing-configuration","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}