We can’t really see the internals so not sure how ...
# suitescript
c
We can’t really see the internals so not sure how it’s reading the log level value during script execution. I know it uses graalVM though so you’d think it would sit in some cache on that JVM. @erictgrubaugh
b
its most visible on client scripts, but N/log has no logic to not call the server when the log level is not high enough
e
It's quite puzzling, I agree, but that's still how it works. It's even more puzzling because the
logLevel
is a property in the
runtime.Script
instance, so it does (or can) easily get pulled into the context.
c
How did you trace this to the point where you know it's reading something from the server?
e
It's from anecdotal experience rather than digging through the internals. Once upon a time, we were working on reducing the runtime of a Scheduled Script which was taking over an hour to complete on a fixed data set, and that was after as many code optimizations as we could think of. Someone brought up the idea of reducing/eliminating the logging to see what that would do, so we set up that experiment. We compared the runtime of: 1. the code as it was with DEBUG log level set on the Deployment 2. the same code with EMERGENCY log level set on the Deployment 3. the same code with all the
log
calls commented out. 1 and 2 performed exactly the same, completing in around an hour. 3 completed in 8 minutes. The script was doing a lot of logging, FWIW
😲 2
c
That's incredible.
e
It was unbelievable
Since then I have just operated on the assumption that logging is expensive
and shoudl probably carry a governance penalty