In IE9, if console is not opened, this code:
alert(typeof console);
will show "object", but this code
alert(typeof console.log);
will throw TypeError exception, but not return undefined value;
So, guaranteed version of code will look similar to this:
try {
if (window.console && window.console.log) {
my_console_log = window.console.log;
}
} catch (e) {
my_console_log = function() {};
}