Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log levels don't work correctly with robot:flatten #4921

Closed
pekkaklarck opened this issue Nov 2, 2023 · 2 comments
Closed

Log levels don't work correctly with robot:flatten #4921

pekkaklarck opened this issue Nov 2, 2023 · 2 comments

Comments

@pekkaklarck
Copy link
Member

This problems was initially reported as part of #4919. It can be reproduced, for example, with this keyword:

*** Keywords ***
Flatten with levels
    [Tags]    robot:flatten
    Log    INFO 1         INFO
    Log    DEBUG 1        DEBUG
    ${old} =    Set Log Level    DEBUG
    Log    INFO 2         INFO
    Log    DEBUG 2        DEBUG

When the above keyword is run, it produces the following messages:

15:04:58.453 	INFO 	INFO 1 	
15:04:58.453 	DEBUG 	DEBUG 1 	
15:04:58.453 	INFO 	Log level changed from TRACE to DEBUG. 	
15:04:58.453 	INFO 	${old} = TRACE 	
15:04:58.453 	INFO 	INFO 2 	
15:04:58.453 	DEBUG 	DEBUG 2

This is obviously wrong. The first debug message shouldn't be there and the message about the level change should show "from INFO to DEBUG".

@pekkaklarck
Copy link
Member Author

The root cause is that we use a different XML logger when flattening than normally, and that logger has its log level set to TRACE regardless what is set from the command line. Initializing the flat logger correctly wouldn't be hard, but then we needed to add extra logic for keeping the loggers in sync in case Set Log Level is used. A much simpler alternative is changing flattening so that we have just one XML logger and that handles flattening itself. A big benefit of this approach is that it simplifies the code considerably.

@pekkaklarck
Copy link
Member Author

Raised the priority because log levels not working properly may even disclose confidential information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant