Hey guys i have modified the run_tests function in DiscoverRunner to mee the requirements . If someone and try and let me know if i have done it right The ticket No : 33058 https://code.djangoproject.com/ticket/33058#no1

I am new to contribution so really looking for your valuable feedback

The Ticket description :

Currently, when a logger is passed to DiscoverRunner, there is at least one case where DiscoverRunner’s logger isn’t used for logging log-like messages. This is when DiscoverRunner runs the check command (code ​here) and displays a message like the “System check identified no issues …”

While there is some overlap with ticket 21429 (which is about logging for all commands), I think this ticket can be kept separate because it can be done independently, and in particular either before or after that ticket is complete.

I do have at least one idea of how this ticket can be addressed pretty simply, and in a way that would help make tangible forward progress on 21429. I can add a comment to that ticket explaining the approach in order to keep followers of that ticket in the loop.

This is my Fix :

def run_checks(self, databases):

# Checks are run after database creation since some checks require

# database access.

“”"

Run checks and send output through logger instead of stdout.

“”"

if self.logger:

# Capture stdout

stdout_capture = StringIO()

stderr_capture = StringIO()

with redirect_stdout(stdout_capture), redirect_stderr(stderr_capture):

# Run the check command

call_command(“check”, verbosity=self.verbosity, databases=databases)

# Send captured output to logger

stdout_output = stdout_capture.getvalue().strip()

stderr_output = stderr_capture.getvalue().strip()

if stdout_output:

self.logger.info(stdout_output)

if stderr_output:

self.logger.error(stderr_output)

else:

# No custom logger, use default behavior

call_command(“check”, verbosity=self.verbosity, databases=databases)