{"record":{"id":"c3e08e276a514a9a","repo":"pentaho/pentaho-kettle","slug":"trans-exception-unabletoperformloggingattransend","errorCode":null,"errorMessage":"Trans.Exception.UnableToPerformLoggingAtTransEnd","messagePattern":"Trans\\.Exception\\.UnableToPerformLoggingAtTransEnd","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/Trans.java","lineNumber":2525,"sourceCode":"              public void transFinished( Trans trans ) {\n                timer.cancel();\n              }\n            } );\n          }\n\n          // Add a listener to make sure that the last record is also written when transformation finishes...\n          //\n          addTransListener( new TransAdapter() {\n            @Override\n            public void transFinished( Trans trans ) throws KettleException {\n              try {\n                endProcessing();\n\n                lastWrittenStepPerformanceSequenceNr =\n                  writeStepPerformanceLogRecords( lastWrittenStepPerformanceSequenceNr, LogStatus.END );\n\n              } catch ( KettleException e ) {\n                throw new KettleException( BaseMessages.getString( PKG,\n                  \"Trans.Exception.UnableToPerformLoggingAtTransEnd\" ), e );\n              }\n            }\n          } );\n\n        }\n\n        // If we need to write out the step logging information, do so at the end of the transformation too...\n        //\n        StepLogTable stepLogTable = transMeta.getStepLogTable();\n        if ( stepLogTable.isDefined() ) {\n          addTransListener( new TransAdapter() {\n            @Override\n            public void transFinished( Trans trans ) throws KettleException {\n              try {\n                writeStepLogInformation();\n              } catch ( KettleException e ) {\n                throw new KettleException( BaseMessages.getString( PKG,","sourceCodeStart":2507,"sourceCodeEnd":2543,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/Trans.java#L2507-L2543","documentation":"Thrown from a TransListener added in Trans.beginProcessing(): when the transformation finishes, endProcessing() and writeStepPerformanceLogRecords(...) write final log/step-performance records; if that raises KettleException it is rethrown as UnableToPerformLoggingAtTransEnd. The transformation itself has already run; only the final logging write-out failed.","triggerScenarios":"A TransAdapter.transFinished listener wraps endProcessing() plus writeStepPerformanceLogRecords(..., LogStatus.END) in try/catch(KettleException) and rethrows with key Trans.Exception.UnableToPerformLoggingAtTransEnd; requires step performance logging to be enabled (transPerfMonitors / performance log table configured).","commonSituations":"Step performance log table connection lost during a long-running transformation; database restarted while the transformation ran; log table full/disk quota exceeded; performance log table schema altered.","solutions":["Check the cause exception for the underlying database error (connection closed, table missing) and fix the log database.","Verify the step performance log table exists with the correct schema; recreate via the Log tab SQL generation.","Enable log table batching/reconnection or use interval logging to reduce long-held connections that get dropped by firewalls.","Recover run results from the transformation log table's earlier rows; the transformation execution itself was unaffected."],"exampleFix":"// before: long transformation, DB connection idle-dropped, final perf record write fails\n// after: enable interval logging on the trans log table\nInterval in seconds = 30  (Log tab, keeps connection alive and writes periodically)","handlingStrategy":"try-catch","validationCode":"// Verify step performance log table connectivity before the run\nDatabaseMeta perfDb = logTable.getDatabaseMeta();\nif (!new Database(trans, perfDb).checkTableExists(\"STEP_PERFORMANCE\")) {\n  log.warn(\"Step performance log table missing; final perf write will fail\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.waitUntilFinished();\n} catch (Exception e) {\n  Throwable root = e;\n  while (root.getCause() != null) root = root.getCause();\n  log.error(\"End-of-run logging failed; transformation result still in trans log table\", root);\n}","preventionTips":["Enable interval logging to keep the log connection from idling out on firewalls.","Monitor DB uptime during long transformations.","Set reasonable row limits on step performance logging to avoid huge final writes."],"tags":["database","logging","listener","performance-metrics"],"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"}