Logging in Custom Handler for TorchServe
I have written a custom handler for an DL model using torch-serve and am trying to understand how to add manual log messages to the handler. I know that I can simply print any messages and it will show them within the MODEL_LOG logger at level INFO.
What if I want to add a custom message at DEBUG level or ERROR level? When I try to initialise a logger using
logger = logging.getLogger('model_log') and add a message within the handler using logger.error I see the output on screen but at INFO level.
What is the best way to create log messages within a handler at a chosen log-level?

I am trying to do something similar. I found example logger usage in base_handler.py, where the logger is initialized on line 23 as:
logger = logging.getLogger(__name__) and used in several places in the rest of the source file, typically as: logger.debug() or logger.warning(), etc. I am assuming that these messages end up in the relevant files under the logs/ folder of TorchServe. I hope it is useful for your particular use case.
