I'm playing around with using Genie in a python script. Whenever I do anything with Genie, like device.connect(), it prints the output to the console. How do I suppress that? Thanks, Mike
Solved! Go to Solution.
Given a device instance, you can change the log settings via the connectionmgr instance.
# dev is a Device instance from a testbed
# now execute a command and you will not see the output on the console
resp = dev.execute('show version')
# you can print the response
Thanks Jeremy! That did the trick. However when I use dev.connect(log_stdout=False) then the output is not logged to a file. A few follow up questions:
Hi @Mike Assel,
re: connect(log_stdout=False) I learned via a response on Twitter from one of the DevNet genie developers. After I learned this, I did a scan of the sourcecode and I could not find any reference to this Device() argument either. Seem like an opportunity for the DevNet team to add more documentation.
re: logging - even though the console logging is disabled, there is still a logfile. You can find it using the Device.logfile attribute, for example:
In : dev.logfile Out: '/tmp/atlrs21-cli-20191021T024126194.log'
I have not experimented with changing the logfile value.
Hope this helps!
My bad. I had checked and thought I did not see a log file, but I checked again and indeed it was there. Thanks for the help.