Repository: comfyanonymous/ComfyUI

Issue:
Lots of web server connection info spam after pulling yesterday's source, --dont-print-server doesn't work
Mostly it's winsock and access logs, but there's a ton of spam because custom nodes all have their own JS files and stylesheets.  Just mousing over the graph caused multiple reloads of JS / CSS for some reason, so it's not very reasonable to display INFO level stuff in the shell even in verbose mode.  The main issue being that it buries the custom node loading messages, and those need to be gone over every time I pull a new revision of Comfy or the larger node sets to make sure something that hasn't been updated in a while isn't broken since some of them try to modify built-in nodes without mentioning it and screw up the entire process.  Previously they were the last thing visible before some spam from mtb so I could just switch to the cmd window and look for load fail messages.    Logging it to file could be reasonable if somebody was actually insane enough to run a public facing python web server and needed to keep everything for analysis.   

The normal Windows way of doing this would be to create a category in event viewer for the web server but leave it disabled  unless the user subscribes to that category of events because they need them.  Most use-cases won't because a localhost connection failure requires that the entire TCP/IP stack be intentionally corrupted, which can be done if you really want to, but in that case Windows will stop working correctly too.  

A very small portion of a run in which I didn't actually do anything except switch browser tabs looks like this right up until I killed it:
```
C:\Programs\ComfyUI>comfy
** ComfyUI start up time: 2023-08-27 04:35:47.286040

Prestartup times for custom nodes:
   0.0 seconds: C:\Programs\ComfyUI\custom_nodes\rgthree-comfy
   0.0 seconds: C:\Programs\ComfyUI\custom_nodes\ComfyUI-Manager

Using directml with device: AMD Radeon RX 7900 XTX
Total VRAM 1024 MB, total RAM 524144 MB
Set vram state to: NORMAL_VRAM
Device: privateuseone
Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
bin C:\Programs\Python310\lib\site-packages\bitsandbytes\libbitsandbytes_cpu.so
C:\Programs\Python310\lib\site-packages\bitsandbytes\cextension.py:34: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable.
  warn("The installed version of bitsandbytes was compiled without GPU support. "
function 'cadam32bit_grad_fp32' not found
2023-08-27 04:35:50.418341: I tensorflow/c/logging.cc:34] Successfully opened dynamic library C:\Programs\Python310\lib\site-packages\tensorflow-plugins/directml/directml.d6f03b303ac3c4f2eeb8ca631688c9757b361310.dll
2023-08-27 04:35:50.418428: I tensorflow/c/logging.cc:34] Successfully opened dynamic library dxgi.dll
2023-08-27 04:35:50.419733: I tensorflow/c/logging.cc:34] Successfully opened dynamic library d3d12.dll
2023-08-27 04:35:50.420613: I tensorflow/c/logging.cc:34] DirectML device enumeration: found 1 compatible adapters.

SNIP ~100 lines of add-on init messages which get buried immediately 

INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:55 +0000] "GET /lib/litegraph.css HTTP/1.1" 304 203 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"

SNIP 200+ more lines of HTTP access logs

INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:56 +0000] "GET /lib/fabric.js HTTP/1.1" 304 204 "http://127.0.0.1:8188/extensions/AlekPet_Nodes/painter_node.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:56 +0000] "GET /extensions/ComfyUI-Custom-Scripts/js/common/spinner.css HTTP/1.1" 200 259 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:56 +0000] "GET /extensions/ComfyUI-Custom-Scripts/js/loraInfo.css HTTP/1.1" 200 260 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:56 +0000] "GET /extensions/ComfyUI-Custom-Scripts/js/common/lightbox.css HTTP/1.1" 200 260 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:56 +0000] "GET /favicon.ico HTTP/1.1" 404 173 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:56 +0000] "GET /mtb/debug HTTP/1.1" 200 176 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:56 +0000] "GET /object_info HTTP/1.1" 200 1155636 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:57 +0000] "GET /component/get_workflows HTTP/1.1" 404 173 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:57 +0000] "POST /mtb/debug HTTP/1.1" 200 189 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:57 +0000] "GET /pysssss/workflows HTTP/1.1" 200 159 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:57 +0000] "GET /extensions/ComfyUI-Custom-Scripts/js/assets/canvas2svg.js HTTP/1.1" 304 203 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:35:57 +0000] "GET /view?filename=QRCode.png&type=input&subfolder= HTTP/1.1" 304 233 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:websockets.server:connection open
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:36:17 +0000] "POST /pysssss/workflows HTTP/1.1" 201 155 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:36:17 +0000] "GET /pysssss/workflows HTTP/1.1" 200 168 "http://127.0.0.1:8188/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:aiohttp.access:127.0.0.1 [27/Aug/2023:08:36:14 +0000] "GET /ws HTTP/1.1" 101 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
INFO:websockets.server:connection closed
```

I was able to do a quick hack to drop the aiohttp debug levels when the command line option is set by modifying server.py's start method:

```python
    async def start(self, address, port, verbose=True, call_on_start=None):        
        
        runner = web.AppRunner(self.app)
        await runner.setup()
        
        if not verbose and isinstance(runner.app.logger, logging.Logger):
            print("Setting loglevel to warning on server.")
            aiohttp.log.web_logger.setLevel(logging.WARNING)
            aiohttp.log.access_logger.setLevel(logging.WARNING)
            aiohttp.log.server_logger.setLevel(logging.WARNING)
            aiohttp.log.client_logger.setLevel(logging.WARNING)
            aiohttp.log.ws_logger.setLevel(logging.WARNING)
            aiohttp.log.internal_logger.setLevel(logging.WARNING)
        ....

```

The [aiohttp page has suggestions on how to do this](https://docs.aiohttp.org/en/stable/logging.html) that are probably more correct, but the spammiest one (access) needs to be set to a custom logger in the run_app call and if you're going to do that you might as well just use the one with the same naming convention and set it wherever you feel like, IMO.  The websockets ones should probably be disabled when the command line flag is used too, but there aren't very many of them. 

Note that I never saw anything from web_logger, server_logger, client_logger, or ws_logger, but I didn't feel like tracking this down again and I'll forget in a day. 

The best option would be globally changing Logger output level for everything to avoid some other library flooding the terminal in a month, but since python somehow managed to create an inline documentation format that seems to contain more formatting than the actual docs it generates on their site and nothing in the source file was immediately obvious (nor was I sure that the web server library would actually consistently use the Logger for output or not reset log levels somewhere at that point) I didn't feel like hunting through it further.  


Discussion:
Can you share your `pip list` output?(Maybe as file attachment...)
[pip_list.txt](https://github.com/comfyanonymous/ComfyUI/files/12454950/pip_list.txt)

Here you go.  I just noticed the requirements.txt doesn't specify a version for aiohttp and mine just stayed on 3.8.4 but .github\workflows\windows_release_nightly_pytorch.yml lists aiohttp==3.8.5, if this makes any difference.  I updated through the ComfyUI manager module instead of git pull this time which (I think?) handles running the requiements again.   It seems like pip tries to pull as little as possible from the requirements list as long as any strict minimum version requirements are met, anyway.

Resolving patch:
diff --git a/server.py b/server.py
--- a/server.py
+++ b/server.py
@@ -603,7 +603,7 @@ async def publish_loop(self):
             await self.send(*msg)
 
     async def start(self, address, port, verbose=True, call_on_start=None):
-        runner = web.AppRunner(self.app)
+        runner = web.AppRunner(self.app, access_log=None)
         await runner.setup()
         site = web.TCPSite(runner, address, port)
         await site.start()


Test patch: