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

Documentation of log config files #291

Closed
c-git opened this issue Nov 10, 2022 · 13 comments · Fixed by #308
Closed

Documentation of log config files #291

c-git opened this issue Nov 10, 2022 · 13 comments · Fixed by #308
Labels

Comments

@c-git
Copy link
Contributor

c-git commented Nov 10, 2022

Please pardon my ignorance, I've been looking around but haven't been able to find anywhere that lists what is expected to be in a config file to load the configuration. I've found a few example but nothing that explains what all the options are. Does this exist and I just missed it? In the documentation it says, "...The file module documentation covers the exact configuration syntax, but an example in the YAML format is provided below...". I've tried looking but I haven't been able to find it. Would appreciate if someone can point me in the right direction.

@estk
Copy link
Owner

estk commented Dec 2, 2022

Hi @c-git I'm not sure I totally understand the question. Are you asking how to load a config at a particular path?
If so check out: https://docs.rs/log4rs/1.2.0/log4rs/fn.init_file.html

@estk estk added the question label Dec 2, 2022
@c-git
Copy link
Contributor Author

c-git commented Dec 2, 2022

Thank you very much for taking the time to respond and for all the work you do on this crate. My apologies on not being clear. The example in the examples folder plus an article I found on medium helped me get a working setup. What I was (and still am) trying to understand was how would I understand what options are available for use in the file that is loaded. I think for right now I've gotten the rotation I need based of the medium article but if it wasn't for the article I'm not sure I would know how to go about setting up the config file to load. So what I'm trying to ask is not so much for an example, but rather somewhere that explains how to create the config file, like what options you can choose from. I hope this helps explain what I'm requesting but if not please let me know and I will try again. In short what I'm looking for is somewhere that says what the crate is capable of doing and how to make use of those capabilities. I tried checking the docs but I wasn't able to figure it out.

PS. If you are not opposed I am willing to do a PR submitting 2 more examples one with rotation by time and the other with rotation by size, as I feel those are probably common use cases that others will also be looking for. Of course, the one based on time would have to be after I understand how to do by time, but I think am already able right now to create a new example from the existing example of logging to a file to add rotation.

@estk
Copy link
Owner

estk commented Dec 2, 2022

@c-git that sounds great, I would love to have more examples and documentation.

@c-git
Copy link
Contributor Author

c-git commented Dec 2, 2022

Ok will do. I'll try to put the PR together. Is there somewhere I can learn about the rotation by time?

@c-git
Copy link
Contributor Author

c-git commented Dec 14, 2022

I've created the example for logging to a file with a size based trigger but I haven't been able to find info yet on how to do a time based trigger. If someone could point me in the right direction that would be appreciated.

@SteveLauC
Copy link
Contributor

The file module documentation covers the exact configuration syntax, but an example in the YAML format is provided below.

source: configuration section of doc

Come here for the same question, and after viewing your dialog, I am still a little bit confused, does this file module documentation exist?


Thanks for the great effort put into this crate!

@bconn98
Copy link
Collaborator

bconn98 commented Jan 13, 2023

Take a look here: https://docs.rs/log4rs/0.8.3/log4rs/encode/pattern/index.html#formatters

@c-git
Copy link
Contributor Author

c-git commented Jan 13, 2023

I'm sorry but I couldn't find where that link explains how one should go about building a YAML file to be used with log4rs.

@bconn98
Copy link
Collaborator

bconn98 commented Jan 14, 2023

Apologies, I was also looking for complete configuration documentation but also the encoder information. When I found the encoder information, I forgot that you were looking just for the greater config documentation not the encoder.

@c-git
Copy link
Contributor Author

c-git commented Jan 17, 2023

Apologies, I was also looking for complete configuration documentation but also the encoder information. When I found the encoder information, I forgot that you were looking just for the greater config documentation not the encoder.

I see thanks for explaining.

My original question and what I think @SteveLauC was also asking is does the detailed documentation for the file format exists, as we couldn't find it even thought it was referenced by the documentation.

@c-git c-git closed this as completed Jan 17, 2023
@c-git c-git reopened this Jan 17, 2023
@bconn98
Copy link
Collaborator

bconn98 commented Feb 11, 2023

I think I can back work this from the code and would be happy to do so. I'm just not sure where @estk keeps the documentation?

@bconn98
Copy link
Collaborator

bconn98 commented Apr 1, 2023

I've posted a PR to add the documentation.

@c-git
Copy link
Contributor Author

c-git commented Apr 12, 2023

Thank you very much, appreciate the documentation.

@estk estk closed this as completed in #308 Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants