2014-11-04 22:52 GMT+02:00 Tatu Aalto <
aalto...@gmail.com>:
>
> But in my opinion, increasing the log level to TRACE is the most easiest
> option. It is true that log size will increase on TRACE level and size of
> the log was a big problem before the 2.6 release [1]. But after that release
> the log size should not be a problem
Log size can still be a problem on TRACE level. For example, if you
read a massive file into a variable like
${content} = Get File ${path}
the value of ${content} will still be big in the current logs. This is
the main reason variable values are not shown by default.
My general recommendation is not to run tests using TRACE by default.
Even if the aforementioned problem wouldn't be an issue now, log file
size can cause problems in the future and the log level must be
raised. Dealing that situation can be hard if no care has been taken
to log values when needed earlier. Anyway, this is just my general
recommendation and definitely does not apply to all context.
My general recommendation how to handle logging variable values is this:
- Library keywords should logs values themselves using INFO or DEBUG
level, unless there's a change a value is big. For example,
Selenium(2)Library logs messages like `Typing text 'foo' into text
field 'example'.
- If library keywords don't log values themselves, user keywords using
them can easily do that using `Log` or `Log Many` keywords.
- If a certain value is important to see during execution, keywords
can log it to console. Library keywords can use `robot.api.logger` or
`sys.__stdout__.write` for that purpose, and user keywords can use
`Log To Console` or `Log` with `console=yes`.
- If a certain value is important to easily see after execution,
keywords can dynamically add it to test message or documentation.
There are `Set Test Message` and `Set Test Documentation` keywords for
this purpose. Library keywords can use them by using `BuiltIn`
programmatically.
Cheers,
.peke
--
Agile Tester/Developer/Consultant ::
http://eliga.fi
Lead Developer of Robot Framework ::
http://robotframework.org