Botframework-sdk: Can't see any logging in Azure portal from the bot

Created on 25 Dec 2016  路  5Comments  路  Source: microsoft/botframework-sdk

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?

help wanted

Most helpful comment

Try the following workaround.

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

```javascript
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 }

}

All 5 comments

@hailiu2586, do you have any suggestions?

Try the following workaround.

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

```javascript
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 }

}

Awesome, that works perfectly!! Thanks @hailiu2586 馃憤

Any help on how to diagnose deployment errors?

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

The fix didn't work for me...

Was this page helpful?
0 / 5 - 0 ratings