-
Notifications
You must be signed in to change notification settings - Fork 463
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
Log folder does not exist, causing silent failure at start up #603
Comments
I have mixed feelings here. This doesn't solve another very common situation. A user runs as root once (because you know, that what happens most of the time with non Unix people), and then when the system runs as a regular user, it still can't write the log, and you have the same visibility problem. Wouldn't it be better to just bubble up an exception so that the logger configuration gets renamed as If there's a typo in the log path, we still want to correct it instead of creating a new directory somewhere, perhaps out of a volume or filesystem we really want. As always, I like to be proven wrong (which is usually an easy task :) so I'm listening to your comments. |
My opinion is attempt the directory and file creation, if it still fails make the logger a .BAD and do a printstacktrace. printstacktrace because you may not have redirected the standard outs to the q2 log which can help with debugging. My case is a little weirds we write different logs in addition to q2 to the log directory, the others create the log folder (logback and jetty), so down the line the q2 starts getting written there as the log folder is now available, though initially it failed. In my test case I create the log (or xyz as in the example) folder in the unit test before starting q2, so we worked around it. |
What if we add a property for that?
So the dev/maintainer has a choice. It can be false in prod and true in dev
or test envs via Environment properties or different configurations
|
Property would work, it's the easiest way to keep things backwards compatible and move forward with updated development. |
If the
logName
is likexyx/a.log
and the xyz folder does not exist a FileNotFound exception is thrown and since the log file is not there it gets lost.https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/util/RotateLogListener.java#L154-L161
I have made a local code change to create the path directories
And a unit test for my environment where the logger deploy has the appropriate prefix suffix
The text was updated successfully, but these errors were encountered: