Repository: bokeh/bokeh

Issue:
[BUG] Cannot apply patch to [id] which is not in the document anymore
#### ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)
bokeh 2.0.0 py37_0
python 3.7.7 hcf32534_0_cpython
WSL Ubuntu 18.04 (hosted on win10
Firefox 75.0 (64-bit)
running the app with command` bokeh serve testapp.py --dev`
#### Description of expected behavior and the observed behavior
in reply to https://github.com/bokeh/bokeh/issues/7738#issuecomment-605670765, I open this new issue:

On updating the layout, the errors
```
2020-05-01 10:43:42,474 Cannot apply patch to 1606 which is not in the document anymore
2020-05-01 10:43:42,475 Cannot apply patch to 1606 which is not in the document anymore
2020-05-01 10:43:42,477 Cannot apply patch to 1606 which is not in the document anymore
2020-05-01 10:43:42,478 Cannot apply patch to 1606 which is not in the document anymore
```
are thrown, where the timestamp and id number change accordingly. **The Webapp however runs unaffected of these messages.**

#### Complete, minimal, self-contained example code that reproduces the issue

```
import numpy as np
import bokeh.io as io
import bokeh.models as mod
import bokeh.layouts as bly
import datetime as dt
from bokeh.plotting import figure

# Set up plots
def MyPlots():
    # make 2 simple plots
    x = np.linspace(0, 15, 200)
    y = np.sin(x)
    plot1 = figure(plot_height=400, plot_width=400, title=str(np.random.normal()))
    plot1.line(x, y,  line_width=3, line_alpha=0.6)

    plot2 = figure(plot_height=400, plot_width=400, title=str(np.random.normal()))
    plot2.line(x, y,  line_width=3, line_alpha=0.6)
    
    return [plot1,plot2]

p1,p2= MyPlots()

# make an input
buttons = mod.RadioButtonGroup( 
    labels=['One', 'Two'])

# callback
def update(attr, old, new):
    pl1,pl2=MyPlots()
    rev.children[0] = pl1
    rev.children[2] = pl2

buttons.on_change('active', update)

# Set up layouts and add to document
rev=bly.column(p1, buttons, p2)
io.curdoc().add_root(rev)

```

#### Stack traceback and/or browser JavaScript console output
no error traceback

#### Screenshots or screencasts of the bug in action



Discussion:
@bokeh/dev I propose we simply lower this from `log.warning` to `log.debug` (or even `log.trace`) with a slightly tweaked message. AFAICT there is basically only one situation that triggers this message, and in that situation ignoring any late changes for the already-removed models is just the correct thing to do, there is no reason to announce it. 
That would be great, +1 from me.
This is a one line change so I have marked GFI. The line is here:

https://github.com/bokeh/bokeh/blob/master/bokeh/document/document.py#L406

But it should be done for 2.1 even if no one new picks it up. 
I'm willing to work on this issue. What do you want the new message to be? 
@naveensaigit great! To be honest the main this is that the log level should be lowered to `debug` or `trace`. The current message is probably OK as is, or you could add "(this is usually harmless)" or similar to the end of it. 
@bryevdv Ok, I'll change this and make a PR

Resolving patch:
diff --git a/bokeh/document/document.py b/bokeh/document/document.py
--- a/bokeh/document/document.py
+++ b/bokeh/document/document.py
@@ -403,7 +403,7 @@ def apply_json_patch(self, patch, setter=None):
                     if patched_id not in self._all_former_model_ids:
                         raise RuntimeError("Cannot apply patch to %s which is not in the document" % (str(patched_id)))
                     else:
-                        log.warning("Cannot apply patch to %s which is not in the document anymore" % (str(patched_id)))
+                        log.debug("Cannot apply patch to %s which is not in the document anymore. This is usually harmless" % (str(patched_id)))
                         break
                 patched_obj = self._all_models[patched_id]
                 attr = event_json['attr']


Test patch: