Duplicate logging inside custom training loop
@m5k5,
I tried to execute the mentioned code on tensorflow v2.12 and it was executed as expected. Kindly find the gist of it [here](https://colab.research.google.com/gist/tilakrayal/9112576d447c1c141bc5c1843a1b999f/untitled1197.ipynb) and confirm whether the output was the same at your end as well. Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60833">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60833">No</a>
 @tilakrayal in your [comment above](https://github.com/tensorflow/tensorflow/issues/60833#issuecomment-1587337858) you mentioned that eveything works. Yes it works, but @m5k5 's point is about logging. I tried your [gist](https://colab.research.google.com/gist/tilakrayal/9112576d447c1c141bc5c1843a1b999f/untitled1197.ipynb) and the annoying runtime logs simply don't show up in the notebook output but they are in the runtime logs (colab -> runtime -> view runtime logs)

IMHO one of the simplest programs to show the problem:
```python
d = tf.data.Dataset.from_tensor_slices(tf.range(10))
next(iter(d)) # logs appear when iterating on the dataset
```
prints this:
```
2023-09-08 09:13:55.788352: I tensorflow/core/common_runtime/executor.cc:1209] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'Placeholder/_0' with dtype int32 and shape [10]
```
Since TF2.12, our logs are cluttered with these incomprehensible logs.
@m5k5 could you please reopen this issue ? Hey @thierryherrmann .
Thanks for mentioning this. I just thought this happens only on my machine for some other reason (maybe the WSL I use).
I see this "You must feed a value for placeholder..." log in Tensorflow 2.12 and 2.13.

 Additional note: in other issues the TF team already suggested that one way of silencing the C++ INFO logs is `os.environ['TF_CPP_MIN_LOG_LEVEL']='1'`. But this silences other useful logs especially when using GPUs. So this would not be an appropriate answer.
@m5k5 I would appreciate if you could reopen the issue. Thanks. I can't reopen the issue, I guess @tilakrayal has to do it. @thierryherrmann @m5k5,
Apologies. As the user requested, Re-opening this issue as it is still valid. Thank you!
<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

No

### Source

source

### Tensorflow Version

TF 2.12.0

### Custom Code

Yes

### OS Platform and Distribution

Windows WSL Ubuntu 20.04

### Mobile device

_No response_

### Python version

3.9.16

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

cuDNN version 8600

### GPU model and memory

GTX 1070

### Current Behaviour?

Hey guys.
I am experiencing a strange behavior when I try to print something from inside my custom training loop.
I want to run the code example as a .ipynb from a Windows machine with WSL Ubuntu 20.04. (https://github.com/m5k5/tf-example). 
The code loops over the dataset and prints out the log statements but it somehow resets the steps after a while:
"
Log at step 80
train step at step  81
train step at step  82
train step at step  83
train step at step  84
train step at step  85
train step at step  86
train step at step  0
Log at step 0
train step at step  1
train step at step  2
train step at step  3
train step at step  4
train step at step  5
"

Originally, I have a project where I need to use the WSL to get the GPU processing within Windows. The print statements are used for logging metrics like accuracy and loss. The values themselves are calculated correctly but there are a lot of duplicates that I can not explain.
Does anyone have similar issues?
Thanks in advance!

### Standalone code to reproduce the issue

```shell
https://github.com/m5k5/tf-example
```


### Relevant log output

```shell
Start of epoch 1
2023-06-10 19:30:47.154065: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'Placeholder/_1' with dtype uint8 and shape [60000]
	 [[{{node Placeholder/_1}}]]
2023-06-10 19:30:47.154065: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'Placeholder/_1' with dtype uint8 and shape [60000]
	 [[{{node Placeholder/_1}}]]
2023-06-10 19:30:47.766468: I tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:424] Loaded cuDNN version 8600
2023-06-10 19:30:47.154065: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'Placeholder/_1' with dtype uint8 and shape [60000]
	 [[{{node Placeholder/_1}}]]
2023-06-10 19:30:47.766468: I tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:424] Loaded cuDNN version 8600
2023-06-10 19:30:48.254207: I tensorflow/compiler/xla/service/service.cc:169] XLA service 0x7f2e52d1a840 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2023-06-10 19:30:48.254240: I tensorflow/compiler/xla/service/service.cc:177]   StreamExecutor device (0): NVIDIA GeForce GTX 1070, Compute Capability 6.1
2023-06-10 19:30:48.256794: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:269] disabling MLIR crash reproducer, set env var `MLIR_CRASH_REPRODUCER_DIRECTORY` to enable.
2023-06-10 19:30:48.348961: I ./tensorflow/compiler/jit/device_compiler.h:180] Compiled cluster using XLA!  This line is logged at most once for the lifetime of the process.
train step at step  0
Log at step 0
train step at step  1
train step at step  2
train step at step  3
train step at step  4
train step at step  5
train step at step  6
train step at step  7
train step at step  8
train step at step  9
train step at step  10
train step at step  11
train step at step  12
train step at step  13
train step at step  14
train step at step  15
train step at step  16
train step at step  17
train step at step  18
train step at step  19
train step at step  20
Log at step 20
train step at step  21
train step at step  22
train step at step  23
train step at step  24
train step at step  25
train step at step  26
train step at step  27
train step at step  28
train step at step  29
train step at step  30
train step at step  31
train step at step  32
train step at step  33
train step at step  34
train step at step  35
train step at step  36
train step at step  37
train step at step  38
train step at step  39
train step at step  40
Log at step 40
train step at step  41
train step at step  42
train step at step  43
train step at step  44
train step at step  45
train step at step  46
train step at step  47
train step at step  48
train step at step  49
train step at step  50
train step at step  51
train step at step  52
train step at step  53
train step at step  54
train step at step  55
train step at step  56
train step at step  57
train step at step  58
train step at step  59
train step at step  60
Log at step 60
train step at step  61
train step at step  62
train step at step  63
train step at step  64
train step at step  65
train step at step  66
train step at step  67
train step at step  68
train step at step  69
train step at step  70
train step at step  71
train step at step  72
train step at step  73
train step at step  74
train step at step  75
train step at step  76
train step at step  77
train step at step  78
train step at step  79
train step at step  80
Log at step 80
train step at step  81
train step at step  82
train step at step  83
train step at step  84
train step at step  85
train step at step  86
train step at step  0
Log at step 0
train step at step  1
train step at step  2
train step at step  3
train step at step  4
train step at step  5
train step at step  6
train step at step  7
train step at step  8
train step at step  9
train step at step  10
train step at step  11
train step at step  12
train step at step  13
train step at step  14
train step at step  15
train step at step  16
train step at step  17
train step at step  18
train step at step  19
train step at step  20
Log at step 20
train step at step  21
train step at step  22
train step at step  23
train step at step  24
train step at step  25
train step at step  26
train step at step  27
train step at step  28
train step at step  29
train step at step  30
train step at step  31
train step at step  32
train step at step  33
train step at step  34
train step at step  35
train step at step  36
train step at step  37
train step at step  38
train step at step  39
train step at step  40
Log at step 40
train step at step  41
train step at step  42
train step at step  43
train step at step  44
train step at step  45
train step at step  46
train step at step  47
train step at step  48
train step at step  49
train step at step  50
train step at step  51
train step at step  52
train step at step  53
train step at step  54
train step at step  55
train step at step  56
train step at step  57
train step at step  58
train step at step  59
train step at step  60
Log at step 60
train step at step  61
train step at step  62
train step at step  63
train step at step  64
train step at step  65
train step at step  66
train step at step  67
train step at step  68
train step at step  69
train step at step  70
train step at step  71
train step at step  72
train step at step  73
train step at step  74
train step at step  75
train step at step  76
train step at step  77
train step at step  78
train step at step  79
train step at step  80
Log at step 80
train step at step  81
train step at step  82
train step at step  83
train step at step  84
train step at step  85
train step at step  86
train step at step  87
train step at step  88
train step at step  89
train step at step  90
train step at step  91
train step at step  92
train step at step  93
train step at step  94
train step at step  95
train step at step  96
train step at step  97
train step at step  98
train step at step  99
train step at step  100
Log at step 100
train step at step  101
train step at step  102
train step at step  103
train step at step  104
train step at step  105
train step at step  106
train step at step  107
train step at step  108
train step at step  109
train step at step  110
train step at step  111
train step at step  112
train step at step  113
train step at step  114
train step at step  115
train step at step  116
train step at step  117
train step at step  118
train step at step  119
train step at step  120
Log at step 120
train step at step  121
train step at step  122
train step at step  123
train step at step  124
train step at step  125
train step at step  126
train step at step  127
train step at step  128
train step at step  129
train step at step  130
train step at step  131
train step at step  132
train step at step  133
train step at step  134
train step at step  135
train step at step  136
train step at step  137
train step at step  138
train step at step  139
train step at step  140
Log at step 140
train step at step  141
train step at step  142
train step at step  143
train step at step  144
train step at step  145
train step at step  146
train step at step  147
train step at step  148
train step at step  149
train step at step  150
train step at step  151
train step at step  152
train step at step  153
train step at step  154
train step at step  155
train step at step  156
train step at step  157
train step at step  158
train step at step  159
train step at step  160
Log at step 160
train step at step  161
train step at step  162
train step at step  163
train step at step  164
train step at step  165
train step at step  166
train step at step  167
train step at step  168
train step at step  169
train step at step  170
train step at step  171
train step at step  172
train step at step  173
train step at step  174
train step at step  0
Log at step 0
train step at step  1
train step at step  2
train step at step  3
train step at step  4
train step at step  5
train step at step  6
train step at step  7
train step at step  8
train step at step  9
train step at step  10
train step at step  11
train step at step  12
train step at step  13
train step at step  14
train step at step  15
train step at step  16
train step at step  17
train step at step  18
train step at step  19
train step at step  20
Log at step 20
train step at step  21
train step at step  22
train step at step  23
train step at step  24
train step at step  25
train step at step  26
train step at step  27
```
</details>