You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hope this is the good place for this, otherwise my apologies.
I am trying to enabling looging on netmiko library using other handlers than StreamHandler and FileHandler, for example RotatingFileHandler. But I cannot make it work.
So I start to trying with one of the handlers that I know that work, in this case StreamHandler.
When i set the log by this way, it work:
The weird thing is that if I set the logging by the first way, and then add a handler to the root looger, for example RotatingFileHandler, the logging works with both handlers.
Any idea?
Thanks in advance.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
I hope this is the good place for this, otherwise my apologies.
I am trying to enabling looging on netmiko library using other handlers than StreamHandler and FileHandler, for example RotatingFileHandler. But I cannot make it work.
So I start to trying with one of the handlers that I know that work, in this case StreamHandler.
When i set the log by this way, it work:
formatter = '%(levelname)s %(name)s %(message)s'
logging.basicConfig(level=logging.DEBUG, format=formatter)
logger = logging.getLogger()
but when i use the handler in this way, it does not work
handler_list = []
formatter = logging.Formatter('%(levelname)s %(name)s %(message)s'')
handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG)
handler.setFormatter(formatter)
handler_list.append(handler)
logging.basicConfig(handlers=handler_list)
logger = logging.getLogger()
The weird thing is that if I set the logging by the first way, and then add a handler to the root looger, for example RotatingFileHandler, the logging works with both handlers.
Any idea?
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions