MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
430 stars 51 forks source link

Set logging to file shows also console - is it a bug ? #3192

Open 53b4 opened 1 year ago

53b4 commented 1 year ago

Hi, I moved this question here from "Disscussions" category because I am not sure if it is a bug. I want to make logging to file, similar like in CefSharp. Does Webview2 has such option ? Right now i only found some possibility that we create environment option : var envOptions = new CoreWebView2EnvironmentOptions() {AdditionalBrowserArguments = "--v=1 --log-file=c:\\temp\\webview.log" }; and after we can use it : await CoreWebView2Environment.CreateAsync(...., envOptions)..

But here is additional problem; despite logging to file starts also console is shown with logs inside; how can I avoid show console and log only into file ? or maybe is another option ?

regards,

AB#43466685

novac42 commented 1 year ago

Thanks for reaching out. I've assigned this to a dev that can best answer your question.

LiangTheDev commented 1 year ago

This is the by design behavior. When --enable-logging is specified, Chromium code will create a console. There is no way around it.

53b4 commented 1 year ago

Hi, Thanks for checking and response. I see but how can log to file? Previously in CEF was CefSettings() class where I can set property LogFile as path to file with logs. Is here similar option ? Regards

LiangTheDev commented 1 year ago

There is currently no way to achieve this. As debug logging is verbose and should only be done by the developer for debugging the app, how important is it to hide the console? The console is kind of a reminder that you don't ship with this to end users. If there is a strong need, we can convert this into a feature request. But don't want to provide something that doesn't help a lot but could potentially shoot oneself in the foot.

53b4 commented 1 year ago

Hi, Please turn this into a feature request; it would be useful to be able to enable file logging, without displaying the console, for diagnostic purposes

LiangTheDev commented 1 year ago

Generated an internal work item to track this. It will be triaged and go through prioritizing, etc.