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
pattern for reloading log4js config when config file changes #978
Comments
Could you post some sample code for what you're trying to do, please? That might help us work out a solution, but basically what you should do is call |
Hi @nomiddlename , Can we call I tested and it works, but I'm not sure if there is any underlying performance impact or memory leak if I use it this way. Use case: To re-configure logging levels on-the-fly Or maybe, can the PS: I wanted to ask this on Slack, but it seems the invitation link is no longer valid. |
The only problem with calling configure without shutdown is that it may leave resources open (file handles, network connections, etc). If you're just logging to console or stdout, or your appender creates a new connection for every log message, then you should be ok to skip shutdown. |
I'm going to close this, because there's no issue to fix. |
@nomiddlename if we're reloading for example to change pattern is there any issue with just calling configure? Also what happens while the logger is shutdown, is there a queue or anything? |
@OmgImAlexis From Keep an updated copy of your configuration (which you will keep changing) to pass into the |
Thank you so so much @peteriman 🙏 |
I'm sure that a github issue is not the appropriate place for this, so I apologize, but I can't find any other place to ask the question.
I know that reloading on config file changes has been removed from log4js, but I am trying to do it myself and I am struggling to figure out how to do this without getting errors. Also, searching github repos for log4js and chokidar or watchr gives no results which makes me think this is not something many people are trying to do?
Is there a sample somewhere that could be added to the documentation to show how to do this? I am trying to use chokidar to do this but no matter what I try I end up with errors due to write operations occurring after the shutdown occurs.
The text was updated successfully, but these errors were encountered: