Questions about Jobs: logs and require path

Hello!

So 2 small questions today:

  1. How can I see logs produced by job? There is no option in webmin as I see (v2.6.3)

  2. If I want to share some logic between job and api how can I do it without copy-paste? Looks like I cannot just require()

Thanks in advance

Hi,

  1. You should be able to see Jobs logging output in the nginx.log in the Log Viewer section. If you’re not, let me know and I’ll take a look.

  2. Jobs run in a completely separate context, so it is not possible to call your custom apis from them (https://develephant.github.io/coronium-core-docs/server/guide/lifecycle/#context). You could try this, but I doubt it would work from the Jobs context: https://develephant.github.io/coronium-core-docs/server/modules/utils/#callapi

-dev

  1. Thanks, found it!

  2. No, I mean don’t mean api call. For example I have some file in default Api project and I want to use this code in job:
     

    local commonLogic = require(“default.commonLogic”) commonLogic.doStuff()

Right now it doesn’t work, that was my question

Edit: It was my fault, code above works as expected!

Hi,

  1. You should be able to see Jobs logging output in the nginx.log in the Log Viewer section. If you’re not, let me know and I’ll take a look.

  2. Jobs run in a completely separate context, so it is not possible to call your custom apis from them (https://develephant.github.io/coronium-core-docs/server/guide/lifecycle/#context). You could try this, but I doubt it would work from the Jobs context: https://develephant.github.io/coronium-core-docs/server/modules/utils/#callapi

-dev

  1. Thanks, found it!

  2. No, I mean don’t mean api call. For example I have some file in default Api project and I want to use this code in job:
     

    local commonLogic = require(“default.commonLogic”) commonLogic.doStuff()

Right now it doesn’t work, that was my question

Edit: It was my fault, code above works as expected!