Logging from Extensions

Good day,

I am working on spinning up a new installation of GenieACS 1.2 due to its automation abilities. At this time, I’m working on an extension script and I am not being successful in getting it to log debugging information anywhere.

GenieACS is installed on a Ubuntu 19 server utilizing the recommended installation method from the GenieACS docs. Therefore, my extension scripts are located in /opt/genieacs/ext. In order to make any libraries load, I created the directory /opt/genieacs/lib and placed a copy of all the libraries in this location.

The first problem is I am unable to load the logger with require("…/lib/logger"); I must specify the full “/opt/genieacs/lib/logger” path. Even then, occasionally, the script will error out with the message:
Channel has faulted; channel=“test” retries=0 faultCode=“ext.Error” faultMessage=“Cannot find module ‘/opt/genieacs/lib/logger’”

I can clear the fault and re-trigger the script and it will work fine the next time. Should I not be using the GenieACS logger library and use a NodeJS logger library instead?

2nd, when the logger does load and the script runs, there is no log output anywhere. I’m sure this is a noob question, but how do I make the extension log to a file so I can debug and know what is happening?

-Eric

I use v1.1 still and use console.log in my extension scripts. Try that and see how that works for you.

Hello,

I was able to get this working in v1.2 by using console.log and using journalctl in follow mode (-f) against the genieacs-cwmp daemon (-c genieacs-cwmp) to view the extension messages. Thanks for the poke in the proper direction.

Eric