Q:

console.log not working when in $(document).ready(function()

Haven't been working with jQuery for a long time. Now, with a fresh new project, I have a somehow strange behaviour.
The scripts are loaded in the correct order:
<script type='text/javascript' src='http://example.com/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script>
some other scripts...

<script type='text/javascript' src='http://example.com/wp-content/themes/mytheme/myscript.js?ver=4.9.7'></script>

myscript.js
(function ($) {
    console.log('logA');
    console.log($.fn.jquery);
    $(document).ready(function(){
        console.log('logB');
        console.log($.fn.jquery);
    });
})(jQuery);

With this code, I'd expect two log outputs:
logA
1.12.4
logB
1.12.4
But instead I only get logA 1.12.4 as output.
logB is not shown in the console, although I can access DOM-elements with $('#elem, .elem2').
What's wrong here?
I also tried without the anonymous function, which gives me an error $ is not a function
 $(document).ready(function(){
      console.log('logB');
 });

jQuery-version: 1.12.4

A:

Through the comments, after a point made by @Rup, it appears that something in the script is overriding the console.log method so that it does not print to the console any more.  To overcome this issue within the scope of your script, you can pass the console.log method into your IIFE, so that it retains the original function that log was assigned.
(function ($, log) {
    log('logA');
    log($.fn.jquery);
    $(document).ready(function(){
        log('logB');
        log($.fn.jquery);
    });
})(jQuery, console.log);

