It's because setBackgroundImage is not finished (asynchronous) when you try to display with the console.log();
html:
<canvas width="320" height="510" id="canvas"></canvas>
<button id="click">Click here !</button>
Javascript:
var canvas = new fabric.Canvas('canvas');
var img = new Image()
img.src = 'http://fabricjs.com/assets/jail_cell_bars.png';
var bgImg = canvas.setBackgroundImage(img.src, canvas.renderAll.bind(canvas), {
width: 320,
height: 510,
originX: 'left',
originY: 'top',
left: 0,
top: 0
});
document.getElementById("click").addEventListener("click", function () {
console.log(bgImg.backgroundImage);
});
In this example, canvas.backgroundImage is displayed in the console when you click on the button : http://jsfiddle.net/LOLKFC/PQe5e/