Home/Support/Support Forum/How to log from python?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to log from python?

0 votes
Hi. What logging options are available for python scripts on a Transport WR41 gateway? Is there any way to log to the device's main event log?

Thanks!
asked Jun 9, 2015 in Python by aragon New to the Community (2 points)

Please log in or register to answer this question.

2 Answers

0 votes
It depends what you are trying to achieve...

from BaseWizard import write_cli

eventlog = write_cli ("type eventlog.txt")
print eventlog

or you could do

eventlog = open("/eventlog.txt")
eventlog_contents = eventlog.read()
print (eventlog_contents)
answered Jun 9, 2015 by NicholasWilson Veteran of the Digi Community (1,001 points)
0 votes
I read it the other way around.

To write to the event log:

from BaseWizard import write_cli

eventlog =write_cli('setevent "this is a test"')
answered Jun 9, 2015 by NicholasWilson Veteran of the Digi Community (1,001 points)
...