-
Notifications
You must be signed in to change notification settings - Fork 2
Logger fails due to unknown log_appenders
module
#11
Comments
Need to look into whether this actually works with the included GraalJS module loading. |
So, for you it's working as you seem to have that module in your lib folder: https://github.com/jpg0/oh-config/blob/master/automation/lib/javascript/personal/node_modules/log_appenders.js I guess that's not installed by npm, and certainly the |
Sure - I have this file because I want to explicitly define additional log appenders. What is supposed to happen is that if you do not want additional appenders and you won't have this module, then the (If you have a better way of doing this then I'm happy to hear it!) |
Usually I would not create the "appender" (or whatever) by myself, instead pass it when creating the logger instance, like with a Dependency Injection system. You can do it with the So first it seems the JS engine here is behaving differently than node, as your code would normally work I think (able to catch the thrown module not found exception)! 🤔 Two approaches come to my mind:
|
Correct, I really want it to be applied to all loggers, within I have considered your first option, however in OH, each script is run in it's own instance of the runtime, meaning no shared state (unless explicitly passed via the host), so it would mean calling the static method at the top of every script. I was not aware of |
No description provided.
The text was updated successfully, but these errors were encountered: