This is an automated email from the ASF dual-hosted git repository.
wuchunfu pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 8687bb8e91 [Improve][Connector-V2] Add some debug log when create dir
in (S)FTP (#8286)
8687bb8e91 is described below
commit 8687bb8e919618360e3edbcc268fc9aee9f91c27
Author: Jia Fan <[email protected]>
AuthorDate: Tue Dec 17 16:51:25 2024 +0800
[Improve][Connector-V2] Add some debug log when create dir in (S)FTP (#8286)
---
.../seatunnel/file/ftp/system/SeaTunnelFTPFileSystem.java | 9 ++++++++-
.../connectors/seatunnel/file/sftp/system/SFTPFileSystem.java | 7 +++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git
a/seatunnel-connectors-v2/connector-file/connector-file-ftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/ftp/system/SeaTunnelFTPFileSystem.java
b/seatunnel-connectors-v2/connector-file/connector-file-ftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/ftp/system/SeaTunnelFTPFileSystem.java
index 029890918d..963d18c703 100644
---
a/seatunnel-connectors-v2/connector-file/connector-file-ftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/ftp/system/SeaTunnelFTPFileSystem.java
+++
b/seatunnel-connectors-v2/connector-file/connector-file-ftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/ftp/system/SeaTunnelFTPFileSystem.java
@@ -342,6 +342,7 @@ public class SeaTunnelFTPFileSystem extends FileSystem {
try {
return getFileStatus(client, file) != null;
} catch (FileNotFoundException fnfe) {
+ LOG.debug("File does not exist: " + file, fnfe);
return false;
}
}
@@ -557,12 +558,18 @@ public class SeaTunnelFTPFileSystem extends FileSystem {
if (created) {
String parentDir = parent.toUri().getPath();
client.changeWorkingDirectory(parentDir);
- created = created && client.makeDirectory(pathName);
+ LOG.debug("Creating directory " + pathName);
+ created = client.makeDirectory(pathName);
}
} else if (isFile(client, absolute)) {
throw new ParentNotDirectoryException(
String.format(
"Can't make directory for path %s since it is a
file.", absolute));
+ } else {
+ LOG.debug("Skipping creation of existing directory " + file);
+ }
+ if (!created) {
+ LOG.debug("Failed to create " + file);
}
return created;
}
diff --git
a/seatunnel-connectors-v2/connector-file/connector-file-sftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sftp/system/SFTPFileSystem.java
b/seatunnel-connectors-v2/connector-file/connector-file-sftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sftp/system/SFTPFileSystem.java
index f49145bc4c..83fccdeb3c 100644
---
a/seatunnel-connectors-v2/connector-file/connector-file-sftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sftp/system/SFTPFileSystem.java
+++
b/seatunnel-connectors-v2/connector-file/connector-file-sftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sftp/system/SFTPFileSystem.java
@@ -147,6 +147,7 @@ public class SFTPFileSystem extends FileSystem {
getFileStatus(channel, file);
return true;
} catch (FileNotFoundException fnfe) {
+ LOG.debug("File does not exist: " + file, fnfe);
return false;
} catch (IOException ioe) {
throw new IOException(E_FILE_STATUS, ioe);
@@ -284,6 +285,7 @@ public class SFTPFileSystem extends FileSystem {
try {
final String previousCwd = client.pwd();
client.cd(parentDir);
+ LOG.debug("Creating directory " + pathName);
client.mkdir(pathName);
client.cd(previousCwd);
} catch (SftpException e) {
@@ -293,6 +295,11 @@ public class SFTPFileSystem extends FileSystem {
}
} else if (isFile(client, absolute)) {
throw new IOException(String.format(E_DIR_CREATE_FROMFILE,
absolute));
+ } else {
+ LOG.debug("Skipping creation of existing directory " + file);
+ }
+ if (!created) {
+ LOG.debug("Failed to create " + file);
}
return created;
}