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

Create and use Custom logger, not modifying root looging module #32

Open
wants to merge 1 commit into
base: comp_changes_pquisby
Choose a base branch
from

Conversation

sousinha97
Copy link
Collaborator

No description provided.

@sousinha97 sousinha97 self-assigned this Nov 21, 2023
@sousinha97 sousinha97 linked an issue Nov 21, 2023 that may be closed by this pull request
Copy link
Collaborator

@dbutenhof dbutenhof left a comment

Choose a reason for hiding this comment

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

Aside from a few style comments, this looks like it'll work, so I'll approve. Getting this change in should remove the duplicate logs that have been bothering us in our server ops review.

The main potential downside is that quisby logging messages will only be in the local ~/.pquisby/pquisby.log file, which means that if we see problems in Opensearch we'll need to log in to the container and hope that the container hasn't been restarted since the problem occurred.

I think I would have preferred that you leave your logger setup as it was, but only on your own getLogger() instance rather than the root logger, so that it wouldn't affect other logging in the process but would still capture Quisby logs (through stderr/conmon) for analysis without having to find your local log file.

if not os.path.exists(log_location):
os.makedirs(log_location)
log_filename = log_location + "pquisby.log"
log_file_max_bytes = 5
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you're defining this as a local variable, I don't see how there's any advantage over simply using maxBytes=5 * 1024 * 1024 below, which would also clarify the units you're using ... maxBytes isn't really a good description since it represents "megabytes".

The same goes for log_backup_count. Separating configuration constants out at the top of the file, or in a separate file, can make sense; but in this case when both are local variables anyway I think just using the values in context would be easier to read.

Comment on lines +30 to +34
# Create a stream handler and add it to the custom logger
# stream_handler = logging.StreamHandler()
# stream_handler.setLevel(log_level)
# stream_handler.setFormatter(formatter)
# custom_logger.addHandler(stream_handler)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you want to merge the commented code? This is your code, but I'd normally recommend against that because it's just confusing for future readers who don't know why it was commented.

Comment on lines +30 to +33
custom_logger.info("********************** Starting preprocessing of data **********************")
custom_logger.info("Input Type: " + str(input_type))
custom_logger.info("Benchmark Type: " + str(test_name))
custom_logger.info("Dataset Name: " + str(dataset_name))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I've noticed these messages, and it makes your log output extremely "noisy". That's less of an issue now that it'll be restricted to your ~/.pquisby/pquisby.log; but do you really need this, with the *** header, for each call?

@@ -0,0 +1,5 @@
from pquisby.lib.logging_configure.custom_logging import configure_custom_logging

custom_logger = configure_custom_logging()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is still being configured at import time rather than at runtime. It's less important now since your custom_logger won't affect anything but Quisby code; but that still seems odd to me.

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

Successfully merging this pull request may close these issues.

Pquisby logging (0.0.27) is problematic
2 participants