{"record":{"id":"ae35f40580967b24","repo":"pentaho/pentaho-kettle","slug":"there-was-an-unexpected-error-while-logging-job-entry","errorCode":null,"errorMessage":"There was an unexpected error while logging job entry information to a log table","messagePattern":"There was an unexpected error while logging job entry information to a log table","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/Job.java","lineNumber":1295,"sourceCode":"   * @throws KettleException\n   *           the kettle exception\n   */\n  protected void writeJobEntryLogInformation() throws KettleException {\n    Database db = null;\n    JobEntryLogTable jobEntryLogTable = getJobMeta().getJobEntryLogTable();\n    try {\n      db = createDataBase( jobEntryLogTable.getDatabaseMeta() );\n      db.shareVariablesWith( this );\n      db.connect();\n      db.setCommit( logCommitSize );\n\n      for ( JobEntryCopy copy : getJobMeta().getJobCopies() ) {\n        db.writeLogRecord( jobEntryLogTable, LogStatus.START, copy, this );\n      }\n\n      db.cleanupLogRecords( jobEntryLogTable, getName() );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"Job.Exception.UnableToJobEntryInformationToLogTable\" ),\n          e );\n    } finally {\n      if ( !db.isAutoCommit() ) {\n        db.commitLog( true, jobEntryLogTable );\n      }\n      db.close();\n    }\n  }\n\n  protected Database createDataBase( DatabaseMeta databaseMeta ) {\n    return new Database( this, databaseMeta );\n  }\n\n  public boolean isInitialized() {\n    int exist = status.get() & BitMaskStatus.INITIALIZED.mask;\n    return exist != 0;\n  }\n","sourceCodeStart":1277,"sourceCodeEnd":1313,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/Job.java#L1277-L1313","documentation":"Job wraps any exception thrown while writing job-entry START log records to the configured job entry log table into a KettleException with this message. The library throws it because logging job entry information to the database log table failed (db.writeLogRecord or db.cleanupLogRecords threw). It signals a logging-infrastructure problem, not a job logic problem, but it aborts the surrounding execution path.","triggerScenarios":"Calling Job execution paths that write job entry log records when the job entry log table is misconfigured, the log database connection is down, the table/schema does not exist, or cleanupLogRecords fails on the log table.","commonSituations":"Log table configured against an unreachable/unsupported database; user lacks INSERT/DELETE rights on the log table; schema changed between Pentaho versions; connection pool exhausted at job start.","solutions":["Verify the job entry log table database connection: test it in the repository/database connection dialog and confirm the DB is reachable.","Check the log table exists with the expected columns for your Pentaho version; recreate it via the log table SQL generation option.","Grant the connection user INSERT/UPDATE/DELETE on the job entry log table.","Review the chained cause exception (getCause()) for the real database error and fix accordingly.","If logging is not needed, disable the job entry log table in the job's logging settings."],"exampleFix":"// before: log table pointing at a dead connection\nJobEntryLogTable table = jobMeta.getJobLogTable();\ntable.setConnectionName(\"prod-log-db\"); // DB down\n// after: validate connection before run\nDatabaseMeta logDb = jobMeta.findDatabase(\"prod-log-db\");\nif (logDb == null || !testConnection(logDb)) {\n  jobMeta.getJobEntryLogTable().setConnectionName(\"local-log-db\");\n}","handlingStrategy":"try-catch","validationCode":"DatabaseMeta logDb = jobMeta.findDatabase(jobMeta.getJobEntryLogTable().getConnectionName());\nif (logDb == null) throw new IllegalStateException(\"Log connection not defined\");\ntry (Database db = new Database(logDb)) { db.connect(); }","typeGuard":null,"tryCatchPattern":"try {\n  job.startExecution();\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"log entry information\")) {\n    log.warn(\"Job entry log table write failed: {}\", e.getCause(), e);\n  } else { throw e; }\n}","preventionTips":["Test the log table connection before each deployment.","Recreate log tables with the version-matching SQL after Pentaho upgrades.","Grant log-table DML rights to the service account.","Monitor job log channel for early DB warnings."],"tags":["logging","database","job-execution"],"backgroundTag":"database-write-failed","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"}