What is your preferred way of logging debugging info?

Hi i wonder what is your preferred way of logging debugging info?
Is writing everything to the wrapper file is the best solution as everything is in one place which needs filtering or is it better to log to the separate file?

Apart from debug logging i believe audit loging is helpful to figure out who pressed what and broke the project :slight_smile:

I create and use loggers named by the project and script they are in, created as top-level objects. Sometimes multiple loggers in a script module if necessary. Then I log profusely at debug level. When debugging, it offers many options to selectively enable DEBUG level to narrow down the problem.

7 Likes

Could you please confirm if you log everything to the wrapper file or separate files?

Auditing should be a totally separate concern with different intentions compared to debug logging.

For audit logging, you can use system.util.audit to programatically insert events into Ignition’s audit log(s).

For debug logging, you should use system.util.getLogger to retrieve a logger object; from a logger object you can log at different levels to filter as @pturmel mentioned, or even add your own context to log statements.

4 Likes

Just wanted to note something that confused me before - but calling system.util.getLogger and using that in the vision client context - this does not go to your wrapper file or server logs. It lasts as long as the vision client lasts and then is gone when it is exited. You can view them in the diagnostic window. Still incredibly useful but just a misconception I had and have seen others have.

3 Likes

thanks for reply
regarding logging on the client - it does match my understanding that the only way to log to the wrapper file from the client is by using system.util.send.message command which will trigger message handler on the gateway

1 Like

hi @PGriffith
Thanks for your reply but i have an issue and i wonder if you could help.

I enabled auditing and i could see some entries logged in to the audit table.
When i tried (behind a Button Press) to use in Client the simplest audit command from the documentation system.util.audit(“The user did a thing!”) i got an error below.
When i checked the syntax i cannot select audit behind the button using intellisense - just wonder if what i am doing is wrong or there is a different way to audit this button press.

According the the docs: system.util.audit - Ignition User Manual 8.0 - Ignition Documentation

system.util.audit wasn’t added until 8.0.13 so it won’t be in the version that you have 8.0.10

3 Likes

@bschroeder well spotted! i read the docs up and down and somehow did not spot the obvious that my version 8.0.10 is not using that functionality.
By the way do you know any other way to achieve functionality similar to system.util.audit?
I would like to know who pressed what which led to some potential problems. :slight_smile:
Regards

Example for Persective:

1 Like