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

Python3-3.10 Hardcoded Log Files #41

Open
trwbox opened this issue Jun 9, 2023 · 0 comments
Open

Python3-3.10 Hardcoded Log Files #41

trwbox opened this issue Jun 9, 2023 · 0 comments

Comments

@trwbox
Copy link

trwbox commented Jun 9, 2023

In PR#39 I mentioned hard coded file names. Specifically in the Log tab of the GUI. After reading more code it became clear that the Log section does not have direct access to the logger being used, meaning some more intricate method is likely needed to make it work properly, and wanted to raise this issue in case somebody has a better idea of how to fix it.

There appear to be a few instances of hardcoded logging file names event.log in the code, dashboard.pyL#647, L#1777, L#1808, and L#7178. This log file can be changed in the file handler in logging.yaml, and if it is changed, it would break all these functions, as that file would no longer exist, or at least not be being used for logging. Ideally this would dynamically handle the changes, allowing for the changing of the log file to work properly.

In my mind, something like this could be added to the fissure_server to dynamically give the file names of the log files in use to any requester. Then corresponding changes in the dashboard to handle this, like only getting a single item from the returned list if there was more than a single file being logged to. But not sure if that is the best option at how to resolve the issue.

    def get_logging_files(self) -> list:
        """Gets all the current files the logger is logging to and returns them as a list

        Returns:
            list: List of all the files the logger is logging to
        """
        # A list that will end up getting returned
        return_list = []
        # Get each of the logging handlers
        for handler in logger.handlers:
            # Only file handlers have the baseFilename attribute
            if hasattr(handler, 'baseFilename'):
                # So if it has that attribute, add the file to the list
                return_list.append(handler.baseFilename)

        # Return the list of files
        return return_list

I think this issue also effects the Pyhton3-3.8 branch as well, and a similar fix of dynamically getting the logging file name should also work there too.

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

No branches or pull requests

1 participant