Finding logger name to use for system.util.setLoggingLevel?

I’m trying to use the system.util.setLoggingLevel in a Gateway Startup script to disable some repetitive logs, but am getting the error,

ValueError: Unable to change logger level: NameError: The Logger tags.history.query.dataloader.DB could not be found.

Obviously it doesn’t like the name I"m using in the script function. I"m using system.util.setLoggingLevel(“tags.history.query.dataloader.DB”, “OFF”). I got the name, tags.history.query.dataloader.DB, straight from the diagnostic logs by hovering over the error (picture below). And confirmed this is the same name in the Diagnostics Settings > Log Configuration. I haven’t found documentation on this anywhere, any ideas? Thanks.

image

Many loggers don’t exist until they are used for the first time, so it’s possible a gateway startup script is too early to find this logger.

That being said… I can’t even find a logger by this name in the codebase right now… what version of Ignition are you using?

1 Like

Try getting the logger before setting its logging level. That’ll create it if not already present.

1 Like

We are on 8.0.10, and noticed this as far back as 8.0.7. So it must not know it exists every time the gateway starts back up? Does it reset, seems like it should know it exists from the codebase.

@pturmel - I will give the system.util.getLogger a try, then use the system.util.setLoggingLevel.

This did the trick. I put the following in the Gateway Startup script taking the built-in logger name from the Diagnostics log names found in settings.

system.util.getLogger("tags.history.query.dataloader.DB")
system.util.setLoggingLevel("tags.history.query.dataloader.DB", "OFF")
2 Likes