Writing to syslog (Re: Test library already imported warning)

82 views
Skip to first unread message

Pekka Klärck

unread,
Jan 8, 2009, 11:00:48 AM1/8/09
to cmta...@ti.com, robotframework-users
2009/1/8 Martin Taylor <cmta...@ti.com>:
>
> An additional question arising from this: RF produces in the log.html
> file a summary of these warnings, but it doesn't seem to be able to
> catch and summarize WARN outputs that my own keywords generate. It
> would be really nice if it did. Is it supposed to? Do I have to do
> something special to get my WARN log lines in the warnings summary at
> the top?

Warnings and errors on top of the log file actually go through the
syslog [1] which automatically writes messages with WARN and ERROR
level there. BuiltIn keyword Syslog can be used to write there from
the test data and in your own Python library you can use
BuiltIn().syslog method.

It's currently not possible to write to syslog from Java libraries (or
from libraries that otherwise cannot use framework's internal modules)
which is a quite big limitation. I have two ideas how to solve the
problem:

1) Add new syntax "log level" that can be used when writing to stdout.
Perhaps something like "print '*SYSLOG-WARN* My message'".

2) Automatically write log messages with level WARN to syslog.
Currently WARN level is a bit useless since you don't see those
messages unless you open the keyword that wrote it and this change
would make them more useful. We could also add new ERROR level that
would also be written to syslog automatically.

Any comments related to this? Both ideas are doable for 2.1.

Cheers,
.peke

[1] http://robotframework.googlecode.com/svn/trunk/doc/userguide/RobotFrameworkUserGuide.html#system-log

Taylor, Martin

unread,
Jan 12, 2009, 7:55:01 AM1/12/09
to Pekka Klärck, robotframework-users
I like the suggestion that WARN, and maybe a new ERROR, message levels automatically go to the SYSLOG and thus also to the summary at the top of the log.html report. I'm currently using WARN to indicate that certain state verification keywords are not yet implemented. Some of these do a forced FAIL, but others use WARN so that important testing following these as yet unimplemented keywords can still proceed.

Thanks,
Martin

Xu Yi

unread,
Jan 13, 2009, 3:14:16 AM1/13/09
to cmta...@ti.com, Pekka Klärck, robotframework-users
well, I'll talk about something loosely related :
- would it be possible to record the pybot command and its output into Robot log file?

there are some error information generated during execution, and are printed on the screen/terminal, when people asking for help, they will save the log file, and no terminal outputs normally. If we could have it in the log file, it may ease the possible troubleshooting later on.

--
- - - - - - - - - -
Xu Yi, Kaverjody
Agile Coach.CSP
Test Automation Coach
Blog : http://damianji.spaces.live.com
- - - - - - - - - -

Pekka Klärck

unread,
Jan 13, 2009, 3:46:12 AM1/13/09
to Xu Yi, cmta...@ti.com, robotframework-users
2009/1/13 Xu Yi <kave...@gmail.com>:

> well, I'll talk about something loosely related :
> - would it be possible to record the pybot command and its output into Robot
> log file?
>
> there are some error information generated during execution, and are printed
> on the screen/terminal, when people asking for help, they will save the log
> file, and no terminal outputs normally. If we could have it in the log file,
> it may ease the possible troubleshooting later on.

All this information already goes to syslog:
http://robotframework.googlecode.com/svn/trunk/doc/userguide/RobotFrameworkUserGuide.html#system-log

Cheers,
.peke

Xu Yi

unread,
Jan 13, 2009, 4:10:20 AM1/13/09
to robotframework-users
2009/1/13 Pekka Klärck <pe...@iki.fi>

but they are still separated. the situation is :
- when people have problem, they will send their log files to us (keyusers) for help, no e.g. syslog file

we could ask them to reproduce the testcase, but ... why not ease it?

Pekka Klärck

unread,
Jan 13, 2009, 4:27:33 AM1/13/09
to kave...@gmail.com, robotframework-users
2009/1/13 Xu Yi <kave...@gmail.com>:

> 2009/1/13 Pekka Klärck <pe...@iki.fi>
>>
>> All this information already goes to syslog:
>>
>> http://robotframework.googlecode.com/svn/trunk/doc/userguide/RobotFrameworkUserGuide.html#system-log
>
> but they are still separated. the situation is :
> - when people have problem, they will send their log files to us (keyusers)
> for help, no e.g. syslog file
>
> we could ask them to reproduce the testcase, but ... why not ease it?

The most common problem with the log file is that it is getting too
big. Adding more information there, especially when that information
is already available in another log, doesn't feel like that good idea
in this situation. Just adding the command line parameters wouldn't
increase the size that much, but that might not be enough and we
needed to add more information. Finally, there currently isn't any
clear place where to add all this information.

Please submit the enhancement idea to the tracker anyway. If it gets
popular (counted from votes/stars) and it's possible to agree on what
information to show, implementing this in the future is possible.

In the meantime, you can instruct your users to always execute tests
with syslog enabled and iinclude also the syslog file when they report
problems. Perhaps you can instruct that ROBOT_SYSLOG_FILE environment
variable is set as part of the installation so that people don't need
to think about it afterwards.

Cheers,
.peke

Pekka Klärck

unread,
Jan 13, 2009, 4:48:08 AM1/13/09
to cmta...@ti.com, robotframework-users
2009/1/12 Taylor, Martin <cmta...@ti.com>:

>
> I like the suggestion that WARN, and maybe a new ERROR, message levels automatically go to the SYSLOG and thus also to the summary at the top of the log.html report. I'm currently using WARN to indicate that certain state verification keywords are not yet implemented. Some of these do a forced FAIL, but others use WARN so that important testing following these as yet unimplemented keywords can still proceed.

This is now issue 200:
http://code.google.com/p/robotframework/issues/detail?id=200

Cheers,
.peke

Pekka Klärck

unread,
Jan 13, 2009, 5:10:02 AM1/13/09
to Xu Yi, robotframework-users
2009/1/13 Xu Yi <kave...@gmail.com>:

> well, I'll talk about something loosely related :
> - would it be possible to record the pybot command and its output into Robot
> log file?
>
> there are some error information generated during execution, and are printed
> on the screen/terminal, when people asking for help, they will save the log
> file, and no terminal outputs normally. If we could have it in the log file,
> it may ease the possible troubleshooting later on.

I somehow only noticed "record pybot command" and not that you also
wanted to get all the console output to the log file too. My earlier
comments were only related to logging the command that started the
execution (and possible some more information about the environment).
As I wrote, adding something like that is possible but it's not likely
to happen in the near future.

On the other hand, writing the terminal output to the log file won't
happen, simply because absolutely everything in the terminal is
already available in the log. This includes all the warnings and
errors written before and during the execution. If you notice
something that is available on the terminal but on the log, please
report it separately since that would be a pretty severe bug.

Cheers,
.peke

Reply all
Reply to author
Forward
0 new messages