Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log info in case of no file found by path_prefix #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

luongnhattruong
Copy link
Contributor

Show info in case no file is found by path_prefix

Copy link
Member

@dmikurube dmikurube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks basically good, but one style comment.

But please allow me to release it later as I'm out of office until Dec 17.

@@ -23,6 +25,7 @@ public class GcsFileInputPlugin
.addDefaultModules().build();
public static final ConfigMapper CONFIG_MAPPER = CONFIG_MAPPER_FACTORY.createConfigMapper();
public static final TaskMapper TASK_MAPPER = CONFIG_MAPPER_FACTORY.createTaskMapper();
private static final Logger LOG = LoggerFactory.getLogger(GcsFileInputPlugin.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use logger instead of LOG?

@muga
Copy link
Contributor

muga commented Feb 3, 2025

@dmikurube Do we have any other improvement to get the PR approval? Please let us know if you have anything.

@@ -23,6 +25,7 @@ public class GcsFileInputPlugin
.addDefaultModules().build();
public static final ConfigMapper CONFIG_MAPPER = CONFIG_MAPPER_FACTORY.createConfigMapper();
public static final TaskMapper TASK_MAPPER = CONFIG_MAPPER_FACTORY.createTaskMapper();
private Logger logger = LoggerFactory.getLogger(GcsFileInputPlugin.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually have the logger instance as a class variable.

Suggested change
private Logger logger = LoggerFactory.getLogger(GcsFileInputPlugin.class);
private static final Logger logger = LoggerFactory.getLogger(GcsFileInputPlugin.class);

@@ -62,6 +65,9 @@ else if (AuthUtils.AuthMethod.private_key.equals(task.getAuthMethod())) {
// list files recursively if path_prefix is specified
if (task.getPathPrefix().isPresent()) {
task.setFiles(GcsFileInput.listFiles(task));
if (task.getFiles().getTaskCount() == 0) {
logger.info("No file is found. Confirm path_prefix option is correct");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, this can happen even if path_prefix is "correct". Just "No file is found there" should be sufficient as a log message.

Suggested change
logger.info("No file is found. Confirm path_prefix option is correct");
logger.info("No file is found in the path(s) identified by path_prefix");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants