Got the solution to this error,
It was because of multiple loggers initialized and all those handlers were not getting cleard - Databricks dlt pipeline handles, my custom code logs etc.
Once I added this command
# Remove existing handlers to avoid duplicates
if logger.hasHandlers():
logger.handlers.clear()
the format of the code got correct.
One more thing I found out was, this unknown formats were nothing but colour codes which we see in the dlt pipeline event logs. Since the handlers was not getting cleared when it was going in my custom code logs it was also trying to add colour code formats there which was causing trouble once I added clear handles before initializing it in my code, It worked