To display custom logs(genrated by python module) on jupyter notebook console

I am running a Jupyter environment (Jupyter Lab) inside a Docker container on a remote server. Inside the container,
user will be provided a python module(custom built), hence I wanted to get the logs of usage of that module on the console (on which jupyter is running) to track user activity.

In my approach I am trying to use python logging library to display logs, I am considering stream handler to push the output logs to console, please find the sample code below

code starts here:"
import logging
import sys
#create a logger
logger = logging.getLogger()
formatter = logging.Formatter(‘%(asctime)s - %(name)s - %(lineno)s - %(levelname)s - %(message)s’)
consoleHandler = logging.StreamHandler(sys.stdout)

Problem: When I run the python function post importing the module, log output are displayed as in cell output unlike on the console

Is there any other alternative approach, that can be used to meet the above requirement. Open to suggestions