-
Notifications
You must be signed in to change notification settings - Fork 11
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
Logging and log-rotation. #65
Comments
Implement basic logging of a GET request on /clients, including having the log entry show the number of clients returned in the response.
One thing that's not yet clear to me is if we want all our regular logging to happen at the DEBUG level, or if the normal thing to do is have logs not show debugging output (i.e., assuming the app isn't being run in debug mode) but still show intentionally logged regular events such as GET requests on |
Add more logging calls to the clients endpoint. Next I'll add these to the rest of the endpoints. The Log4J config file determines how detailed to get in the logging. INFO is slightly less detailed than DEBUG, so with this change we'll get less logging output total (in both catalina.out and OpenHMIS.log), but we will get all the INFO calls we add to the endpoints. Each level is inclusive of the more severe levels, so now that we've set the logging level to INFO we'll see everything in the INFO, WARN, ERROR, and FATAL categories, but not the lower level categories (TRACE and DEBUG). See https://logging.apache.org/log4j/2.x/manual/configuration.html for more. For future debugging we can always change the logging level in log4j.xml to show more detail (e.g., back to DEBUG). For now, though, using INFO should reduce the amount of logging, as requested in #72.
We still might want to include more information, but this should let us know whenever any endpoint is hit.
Note that we may add more logging information and/or change the format.
Merged to master in 634fcbe, but as mentioned in that commit we may yet update the format / add more information to the logging. |
I believe, based on @kfogel's review, that we'll use these formats for all logging statements:
I think Karl wrote that up somewhere, but I couldn't find it. Please link if you see it! |
Ah, miscommunication, sorry. I thought you were going to write it up, you thought I was going to write it up. I sort of did write it up, in issue #76, but we really should have it in the tree... Okay, done in commit 20315dd. Some day when we have server administration documentation, separate from INSTALL.md, the new material can be moved, but for now at least it's in-tree. |
This is a successor to issue #20, and subsumes that issue:
We need to add a log event whenever an endpoint is called, and we need to document how to configure logging and, if necessary, set up log rotatation. The infrastructure for the first part is in place: we're already importing and using log4j. See
src/main/resources/log4j.xml
. See also commit a131612, and maybe commit 1b3de81, for an example of how to instantiate and invoke the logger.(By the way, commit e25c7cb has the addition of the
log4j.xml
file, although that commit was mostly about offering better API responses in error cases.)The text was updated successfully, but these errors were encountered: