Skip to content

Commit 797ca1c

Browse files
authored
Merge pull request #53 from luongnhattruong/improve_log_for_path_prefix
Add log info in case of no file found by path_prefix
2 parents a86ca68 + 71978bc commit 797ca1c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/org/embulk/input/gcs/GcsFileInputPlugin.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import org.embulk.util.config.ConfigMapperFactory;
1212
import org.embulk.util.config.TaskMapper;
1313
import org.embulk.util.config.units.LocalFile;
14+
import org.slf4j.Logger;
15+
import org.slf4j.LoggerFactory;
1416

1517
import java.io.IOException;
1618
import java.util.List;
@@ -23,6 +25,7 @@ public class GcsFileInputPlugin
2325
.addDefaultModules().build();
2426
public static final ConfigMapper CONFIG_MAPPER = CONFIG_MAPPER_FACTORY.createConfigMapper();
2527
public static final TaskMapper TASK_MAPPER = CONFIG_MAPPER_FACTORY.createTaskMapper();
28+
private static final Logger logger = LoggerFactory.getLogger(GcsFileInputPlugin.class);
2629
@Override
2730
public ConfigDiff transaction(ConfigSource config,
2831
FileInputPlugin.Control control)
@@ -62,6 +65,9 @@ else if (AuthUtils.AuthMethod.private_key.equals(task.getAuthMethod())) {
6265
// list files recursively if path_prefix is specified
6366
if (task.getPathPrefix().isPresent()) {
6467
task.setFiles(GcsFileInput.listFiles(task));
68+
if (task.getFiles().getTaskCount() == 0) {
69+
logger.info("No file is found in the path(s) identified by path_prefix");
70+
}
6571
}
6672
else {
6773
if (task.getPathFiles().isEmpty()) {

0 commit comments

Comments
 (0)