sjoerd222888 wrote:A use case for changing log level dynamically is the following:
Let's have a complex industrial application. When a customer detects an issue that is reproducible we can ask them to switch the log level to Debug and do again what caused the issue. This helps to get log data of specific operations without the need of restarting the application.
Thanks. I'm imagined something similar.
Just for note, that there is can be some log (error) messages raised once at startup, or during browser creation. I.e. with dynamic log severity you potentially can miss something important depending from reproduction cycle.
So i'm aggregate a bit:
1. Allow change log severity dynamically. From chromium implementation i'm doesn't see nothing what should prevent do it, and implementation is trivial. (We need just call logging::SetMinLogLevel).
2. Extend CEF API which allow configure own custom log message handler. This should be useful for route log messages to other logging frameworks. (logging::SetLogMessageHandler and probably logging::SetLogAssertHandler can be useful, also note that if log message handler is configured, then file-based logging are disabled (by base/logging.cc implementation.)
In that case you should not needed to filter messages by severity levels manually (manual filtering is counter-efficient, because all log messages will be virtually written (i.e. formatted, and log handler callback called, but this never happens for suppressed logging calls by severity level).
Questions:
@magreenblatt, do you accept this kind changes for CEF if PR will be provided?
@sjoerd222888, do you will try implement this for CEF?
Add: I'm not sure / not checked, how logging for same file happens for renderer process? Renderer process sends IPC messages or just directly write to file? (I'm think that it is writes to file directly.) Just for note, that this is can be not clear how to deal with it. For example for network logging we need log from both processes, but if we create sandboxed application (not a standard .NET application) - we can't do it (?) from renderer process?