botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Can't see any logging in Azure portal from the bot

Open gilesbutler opened this issue 9 years ago • 5 comments

I have a basic piece of code just to log what's in the session and it's not outputting anything to the Log panel in the Bot Service...

bot.dialog('/', [
    function (session) {
        console.log(session);
        const message = "Hello... What's your name?";
        builder.Prompts.text(session, message);
    },
]);

console.log('TEST'); doesn't even log anything either. I've tried to enable logging in the Diagnostic Logs section of the Application Settings but I just get an error: "Failed to update web app logs settings"

Any idea what's going on?

gilesbutler avatar Dec 25 '16 12:12 gilesbutler

@hailiu2586, do you have any suggestions?

dandriscoll avatar Dec 26 '16 20:12 dandriscoll

Try the following workaround.

In your messages/index.js, wrap the returned function from connector.listen() with console.log override, like below:

if (useEmulator) {
    var restify = require('restify');
    var server = restify.createServer();
    server.listen(3978, function() {
        console.log('test bot endpont at http://localhost:3978/api/messages');
    });
    server.post('/api/messages', connector.listen());    
} else {
    var listener = connector.listen();
    var withLogging = function(context, req) {
        console.log = context.log;
        listener(context, req);
    }

    module.exports = { default: withLogging }
}


hailiu2586 avatar Dec 27 '16 20:12 hailiu2586

Awesome, that works perfectly!! Thanks @hailiu2586 👍

gilesbutler avatar Dec 28 '16 05:12 gilesbutler

Any help on how to diagnose deployment errors?

I can't see if there are any errors since there is no diagnostics log.

cesarvarela avatar Jan 14 '17 02:01 cesarvarela

The fix didn't work for me...

ghost avatar Apr 17 '17 16:04 ghost