Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using custom appenders needs more documentation #317

Open
axos88 opened this issue Nov 8, 2023 · 4 comments
Open

Using custom appenders needs more documentation #317

axos88 opened this issue Nov 8, 2023 · 4 comments

Comments

@axos88
Copy link

axos88 commented Nov 8, 2023

I'd like to ask for extra documentation / examples on how to implement and use a custom appender.
I found bits of information (mostly here: https://stackoverflow.com/questions/64862936/how-can-i-create-a-custom-filter-type-using-log4rs), and seems like I have all the pieces now to build the appender, but I'm lost on how to actually initialize log4rs to recognize that if I'm not reading the config from a file (I am reading from a string, since I fall back to include_str! if the config file is not present).

init_raw_config seems to be what I'm looking for, but it does not take a list of Deserialiazers like init_file does.

@bconn98
Copy link
Collaborator

bconn98 commented Nov 30, 2023

@axos88 Would it be possible to build a default configuration in code instead of via a string? Find examples here.

@axos88
Copy link
Author

axos88 commented Dec 2, 2023

Not really, the whole point is to read from a file, if it doesnt exist, fall back to an included str. Generating it programatically would be much more verbose, and would need to duplicate the same thing as a config file when distributing an "example config"

@estk
Copy link
Owner

estk commented Dec 4, 2023

Would it be sufficient to be able to initialize a Configuration from a string then?

@axos88
Copy link
Author

axos88 commented Dec 4, 2023

Yes, but with custom appenders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants