Page 1 of 1

[SOLVED] Hiding logs for a package on the WebUI

Published: July 4, 2022 - 2:56 PM
by tuxmania
Hello,

is it possible to disable the output on the web interface on the "Installed Packages" page?
Let me explain. I want to deploy a package that doesn't perform any print statements or anything else during its execution. The problem is that in case of an error, certain commands containing information I'd prefer to hide are automatically displayed in these logs.
Is there a way to hide them with an option or something else?

Thank you in advance for your help.

Re: Hiding logs for a package on the WebUI

Published: July 5, 2022 - 10:29 PM
by sfonteneau
Good morning

Hiding it in the GUI isn't enough (the traceback will be in the database); it needs to be hidden directly in the Python output:

Something like this should hide the error in the Python code:

Code: Select all

try:
    run('toto.exe')
except Exception as e :
    error('error hide')


Re: Hiding logs for a package on the WebUI

Published: July 6, 2022 - 10:45 AM
by florentR2
Hello,
is it possible to have the same behavior even if there is no error?

Re: Hiding logs for a package on the WebUI

Published: July 6, 2022 - 11:20 AM
by sfonteneau
Hmm, I don't understand.
`run` doesn't display anything by default, so there's no information if there's no `print` or anything else.

Re: Hiding logs for a package on the WebUI

Published: July 6, 2022 - 2:07 PM
by florentR2
Yes, it's slightly different. Nothing is displayed in the console, but in C:\Program Files (x86)\wapt\log I have this in a log file, for example:

Code: Select all

2022-07-06 13:32:49,523 [waptcore WaptTaskManager 5608] WARNING myExe.exe --DonnesSensible=XXX command returns code 58

Re: Hiding logs for a package on the WebUI

Published: July 6, 2022 - 10:25 PM
by sfonteneau
Indeed, I had forgotten about the logger

We need to protect the file:

Code: Select all

C:\Program Files (x86)\wapt\log
To make it accessible only to administrators

Re: Hiding logs for a package on the WebUI

Published: July 8, 2022 - 11:58 AM
by tuxmania
Thank you very much @sfonteneau.

I will indeed go with the try/except solution, which perfectly addresses the problem (plus restricting access to the log file).
Thank you! :)

Re: Hiding logs for a package on the WebUI

Published: July 11, 2022 - 7:18 PM
by dcardon
Limiting access to the log directory under Windows should be available by default in the upcoming version 2.2.2, which should be released very soon.

Re: [SOLVED] Hiding logs for a package on the WebUI

Published: July 12, 2022 - 09:26
by florentR2
Thank you so much!