cancel
Showing results for 
Search instead for 
Did you mean: 

CAP: "console.log" on SCP

kammaje_cis
Active Contributor

I am a noob on SCP, so apologies for a basic question.

I have a few console.log statements as below in my CAP application.

module.exports = cds.service.impl(srv => {
    const {Actions} = cds.entities('cis.fiorianalytics')
    srv.on('CREATE', 'Actions', (req) => {
        console.log("=====>>>>req>>>" + req)
        console.log("=====>>>>SESSION_CONTEXT('APPLICATIONUSER')>>>>>>" + SESSION_CONTEXT('APPLICATIONUSER'))
        console.log("=====>>>>req.user>>>>>>" + req.user)
    });    
});

When running on the server (not local), where can I see these logs? I checked the log on the corresponding srv application, but do not see anything related to these.

Accepted Solutions (1)

Accepted Solutions (1)

qmacro
Developer Advocate
Developer Advocate

You can use the `cf logs <cf app name>` command to view the logs relating to the application once deployed.

In case you're interested, I wrote a post on parsing such logs: "Terminal Tip: parsing CF app logs".

kammaje_cis
Active Contributor
0 Kudos

Thanks DJ. I realized that my event handler was not registered and that is why I was not seeing my console.log outputs. cf log <app> is a useful utility. Thanks for pointng.

Answers (0)