{"record":{"id":"8e5497da15ba8711","repo":"pentaho/pentaho-kettle","slug":"error-retrieving-logfile-string","errorCode":null,"errorMessage":"Error retrieving logfile string","messagePattern":"Error retrieving logfile string","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoader.java","lineNumber":349,"sourceCode":"        sb.append( \" -n -f \" );\n        sb.append( enclosure ).append( KettleVFS.getFilename( fileObject ) ).append( enclosure );\n      } catch ( Exception ex ) {\n        throw new KettleException( \"Error retrieving controlfile string\", ex );\n      }\n    } else {\n      throw new KettleException( \"No control file specified\" );\n    }\n\n    if ( meta.getLogFile() != null ) {\n      try {\n        FileObject fileObject =\n          KettleVFS.getInstance( getTransMeta().getBowl() )\n            .getFileObject( environmentSubstitute( meta.getLogFile() ), getTransMeta() );\n\n        sb.append( \" -o \" );\n        sb.append( enclosure ).append( KettleVFS.getFilename( fileObject ) ).append( enclosure );\n      } catch ( Exception ex ) {\n        throw new KettleException( \"Error retrieving logfile string\", ex );\n      }\n    }\n\n    DatabaseMeta dm = meta.getDatabaseMeta();\n    if ( dm != null ) {\n      String user = Const.NVL( dm.getUsername(), \"\" );\n\n      // Passwords will not work for now because we can't get them to the command line without assuming UNIX and using\n      // an environment variable\n      String pass = Const.NVL( dm.getPassword(), \"\" );\n      if ( password && !pass.equalsIgnoreCase( \"\" ) ) {\n        throw new KettleException(\n          \"Passwords are not supported directly, try configuring \"\n            + \"your connection for trusted access using pg_hba.conf\" );\n      }\n      // if ( ! password )\n      // {\n      // pass = \"******\";","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoader.java#L331-L367","documentation":"When meta.getLogFile() is set, createCommandLine() resolves the log file path via environmentSubstitute() and KettleVFS to append '-o <logfile>' to the psql command. Any exception in that resolution is wrapped in this KettleException with the original error as cause. This is a path-resolution wrapper error, not a validation error (a missing log file is optional).","triggerScenarios":"createCommandLine() runs with meta.getLogFile() non-null and KettleVFS.getFileObject(environmentSubstitute(logFile)) throws: unsupported VFS scheme, invalid path, IO failure, or unresolvable ${VAR} inside the log file path.","commonSituations":"Log path uses a variable undefined at runtime; log directory on a network share not mounted or not covered by a VFS provider; filename contains characters VFS rejects; path points to a scheme like s3:// unsupported by the installed VFS plugins.","solutions":["Inspect ex.getCause() for the underlying VFS failure and fix it (missing provider, bad scheme, permissions).","Make sure every variable in the log path is defined (kettle.properties, transformation parameters, or runtime env).","Use a plain absolute local path (e.g. /var/log/kettle/gpbulk.log) if VFS complexity is not needed.","If logging is unnecessary, clear the log file field entirely - the step skips this block when it is null."],"exampleFix":"// before\nLog file: ${LOG_DIR}/gpbulk.log   (LOG_DIR undefined)\n\n// after\nkettle.properties: LOG_DIR=/var/log/kettle\nLog file: ${LOG_DIR}/gpbulk.log","handlingStrategy":"validation","validationCode":"String log = meta.getLogFile();\nif (log != null && !log.trim().isEmpty()) {\n  String resolved = transformation.environmentSubstitute(log);\n  if (resolved.contains(\"${\"))\n    throw new IllegalArgumentException(\"Unresolved variable in log path: \" + log);\n  java.io.File dir = new java.io.File(resolved).getParentFile();\n  if (dir != null && !dir.canWrite())\n    throw new IllegalArgumentException(\"Log dir not writable: \" + dir);\n}","typeGuard":null,"tryCatchPattern":"try {\n  execute(meta, wait);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"Error retrieving logfile string\")) {\n    logError(\"Log file path resolution failed, continuing without log\", e.getCause());\n    meta.setLogFile(null); // log file is optional; retry without it\n    execute(meta, wait);\n  } else throw e;\n}","preventionTips":["Leave the log file field empty if file logging is not needed - it is optional","Point the log at a plain local directory with write permission for the Kettle user","Define any variable used in the log path in kettle.properties"],"tags":["vfs","log-file","environment-variable","kettle"],"backgroundTag":"file-not-found","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"}