Creating a log and print function that is not working?

Unsure why this is not working, probably some niche reason I am unaware of.

I have two scripts that are involved here,

def universalPrint(message):
	Will work for vision or perspective clients now.
		message: str, what do you want to print
	from env import isVision
	if isVision():
		print message
		import system.perspective

This has works fine and has been use in use for a while.

My new script which is printing, but is not logging, is

def logInfoAndPrint(message, loggerName):
	For instances where we want to both log to the server but also print to console for easier debugging.
		message: anything as we type cast in this function for ease of use, what are we trying to print
		loggerName: str, what logger are we saving this to
	import system.util
	logger = system.util.getLogger(loggerName)
	universalPrint("about to log")

It gets to print the last “logged” statement, but I do not see the actual logged statement in my server logs.

In my console, I see

test message
about to log
09:01:55.877 [AWT-EventQueue-0] INFO test logger - test message

Any ideas whats going on here? Is this not possbile?

From what context are you calling this functions? Client logging writes to the designer console when testing from the designer and i think that is what is shown in your screenshot.
Call the function from a gateway scoped script to write to the gateway log.


I am calling it from key stroke in the live client to test. I know behavior in the script console/designer is not exactly how it works in the client so I am testing it in the client.

If it is a Vision client then the logger will show up in the client diagnostics. If Perspective then it’ll show up at the gateway.

If you want 100% for something to show up in the gateway logs you will need to create a messagehandler and log it from there.

Guess I was mistaken, I thought I had things in the client using system.util.logger to log to the server but on second look I do not. This was just a mistake on my part.

Happens the the best of us. :smiley:

1 Like