jeremytammik / RevitLookup

Interactive Revit RFA and RVT project database exploration tool to view and navigate BIM element parameters, properties and relationships.
http://thebuildingcoder.typepad.com
MIT License
1.11k stars 301 forks source link

CheckUpdatesAsync: No such host is known. #299

Open ricaun opened 1 month ago

ricaun commented 1 month ago

RevitLookup version

2025.0.10

Steps to reproduce

I have some strange logs when my Revit open, I guess start happen after the HostedLifecycleService update.

2024-10-07 15:53:09 [ERR] RevitLookup.Services.SoftwareUpdateService: Checking updates fail. Possible GitHub request limit exceeded
System.Net.Http.HttpRequestException: No such host is known. (api.github.com:443)
 ---> System.Net.Sockets.SocketException (11001): No such host is known.
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.GetStringAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
   at RevitLookup.Services.SoftwareUpdateService.FetchGithubRepositoryAsync()
   at RevitLookup.Services.SoftwareUpdateService.CheckUpdatesAsync()

Does not break anything is just annoying to receive random logs when my Revit open.

There are some way to disable the log in the RevitLookup?

Nice3point commented 1 month ago

You have exceeded your request limit on GitHub, the log says so. There is no way to turn off the logs yet, but we will remove this exception from the journal

ricaun commented 1 month ago

You have exceeded your request limit on GitHub,

I think you are wrong, the exception says 'No such host is known. (api.github.com:443)', maybe for a moment my machine goes offline.

The exceptions is logged in the journal? Nice!

Nice3point commented 1 month ago

Yes, RevitLookup logs important errors to the journal and some messages to the Console. This is useful when users are having issues and require help: https://github.com/jeremytammik/RevitLookup/releases/tag/2025.0.2

No such host is known - https://github.com/dotnet/runtime/issues/54547 Answer: the OS truly not being able to resolve DNS

ricaun commented 1 month ago

Yes, RevitLookup logs important errors to the journal and some messages to the Console. This is useful when users are having issues and require help: https://github.com/jeremytammik/RevitLookup/releases/tag/2025.0.2

Would be possible to change the LogEventLevel to disable messages to go in the Console/Debug?

https://github.com/jeremytammik/RevitLookup/blob/3022f7d298abefd15ceeafe068274d56b3b73a2b/source/RevitLookup/Config/LoggerConfigurator.cs#L20-L28

ricaun commented 1 month ago

I noticed the Event Monitor is sending messages in the Debug.

2024-10-07 19:49:56 [DBG] RevitLookup.Core.EventMonitor:  - missing target
2024-10-07 19:49:56 [DBG] RevitLookup.Core.EventMonitor: RevitLookup EventMonitor: Autodesk.Revit.UI.TextBoxCommandHandler.CanExecuteChanged
2024-10-07 19:49:56 [DBG] RevitLookup.Core.EventMonitor:  - missing target
2024-10-07 19:49:56 [DBG] RevitLookup.Core.EventMonitor: RevitLookup EventMonitor: Autodesk.Revit.UI.TextBox.EnterPressed
...
Nice3point commented 1 month ago

Would be possible to change the LogEventLevel to disable messages to go in the Console/Debug?

What reason do we have to disable logging?

I noticed the Event Monitor is sending messages in the Debug.

If you get such messages, you have probably compiled the project for Debug mode. This is not a recommended way because it is several times worse in performance and contains more logs. Use Release version

ricaun commented 1 month ago

What reason do we have to disable logging?

I don't need that information in the console.

If you get such messages, you have probably compiled the project for Debug mode.

I'm using the last version downloaded from the main release. When I open the Event Monitor.

image

In the release the DEBUG define should be disable, but Serilog have the configuration toMinimumLevel.Debug,

I remember one time I changed to Warning when testing some code to remove the logs.

https://github.com/ricaun/RevitLookup/blob/3ba526e30ba54ae3a0fd23f2317cc44455042652/source/RevitLookup/Config/LoggerConfigurator.cs#L26

The only place that use LogDebug is inside the EventMonitor.

Nice3point commented 1 month ago

I don't need that information in the console.

Personal preference cannot be a reason to remove any functionality

In the release the DEBUG define should be disable, but Serilog have the configuration toMinimumLevel.Debug,

If you run VS in Debug mode, then yes, you will see them because Debug.WriteLine has Condition attribute only for Debug mode. Logs are written only when you open EventMonitor, and you will not notice them when debugging your own plugins

ricaun commented 1 month ago

Personal preference cannot be a reason to remove any functionality

I'm not asking to remove, I'm a big fan of option to disable/change the log level like a configuration for that.

If you run VS in Debug mode, then yes, you will see them because Debug.WriteLine has Condition attribute only for Debug mode.

You are wrong, that debug log is written regardless of the Debug mode, my application catch that in a normal Revit run. image

Nice3point commented 1 month ago

The output to the Console has a minimum level - Information. Apparently your add-in collects logs not only from Console but also from Debug source.

Check screenshot, the Console output does not contain any entries from RevitLookup: изображение

ricaun commented 1 month ago

Yes is collecting from Console and Debug/Trace.

In your case I suppose should show in the Debug Output, the log is hard-code to MinimumLevel.Debug.

Maybe should be Warning in the release version.

ricaun commented 1 month ago

The LoggingLevelSwitch could be used the change the log level on runtime.

Here some reference: https://nblumhardt.com/2014/10/dynamically-changing-the-serilog-level/

ricaun commented 1 month ago

The LoggingLevelSwitch works 😊 https://github.com/ricaun/RevitLookup/tree/dev-loglevel

image

ricaun commented 1 month ago

I create a PR, to add that setting: #300