<script language="javascript">
// cache a reference to the log method on the console object
var _consoleLog = console.log;
// replace the existing log method on the console object
console.log = function() {
// your custom action
alert(arguments[0]);
// pass control to the cached log method
return _consoleLog.apply(console, arguments);
};
// quick test
console.log("hello");
</script>
This will do the trick