You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building a small UI app and would like to use log4rs in a multilog context besides another logger, similarly to https://github.com/davechallis/multi_log . My rationale is that while log4rs can nicely handle console and file logging, displaying messages on a UI is fully out of the scope of this crate and it's probably better to use an independent component there.
Creating a Logger instance from a log4rs Root and then Config instance seems to be nicely supported already. On the other hand, a Handle can be created and used to reload the configuration only when directly setting log4rs as the single global logger instance e.g. using init_config. I'd expect that a Logger has a get_handle(&self) -> Handle or similar function to support config reloads without init_...() functions.
Was it a deliberate choice to prevent this workflow or am I discovering a possible scenario that simply wasn't thought of yet?
The text was updated successfully, but these errors were encountered:
izolyomi
changed the title
Logger reload Handle is inaccessible
Logger reconfigure Handle is inaccessible
Sep 5, 2024
My guess, is that this scenario was not considered when the library was originally created. That said, I see a couple options.
Introduce an appender that writes to a socket or similar, such that your UI can capture and display the logs. This option may be better as you can keep consistent logs across all locations and only need 1 configuration/dependency.
Introduce the Handle as you've described above. I don't immediately see an issue with providing the handle like you're requesting. Feel free to put a PR out and we'll try and get it in. We have had a bit of trouble getting PRs in of late but hopefully can get them rolling again.
First of all, thank you for this awesome library.
I'm building a small UI app and would like to use log4rs in a multilog context besides another logger, similarly to https://github.com/davechallis/multi_log . My rationale is that while log4rs can nicely handle console and file logging, displaying messages on a UI is fully out of the scope of this crate and it's probably better to use an independent component there.
Creating a Logger instance from a log4rs
Root
and thenConfig
instance seems to be nicely supported already. On the other hand, aHandle
can be created and used to reload the configuration only when directly setting log4rs as the single global logger instance e.g. usinginit_config
. I'd expect that aLogger
has aget_handle(&self) -> Handle
or similar function to support config reloads withoutinit_...()
functions.Was it a deliberate choice to prevent this workflow or am I discovering a possible scenario that simply wasn't thought of yet?
The text was updated successfully, but these errors were encountered: