hmis-tools / hmis-api-server

Version 2 of OpenHMIS
Mozilla Public License 2.0
15 stars 11 forks source link

Logging and log-rotation. #65

Open kfogel opened 8 years ago

kfogel commented 8 years ago

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 a1316120de, and maybe commit 1b3de81d49, for an example of how to instantiate and invoke the logger.

(By the way, commit e25c7cb26074e has the addition of the log4j.xml file, although that commit was mostly about offering better API responses in error cases.)

kfogel commented 7 years ago

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 /clients. Need to research standard log4js usage, and general logging conventions, a bit more.

cecilia-donnelly commented 7 years ago

Merged to master in 634fcbe, but as mentioned in that commit we may yet update the format / add more information to the logging.

cecilia-donnelly commented 7 years ago

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!

kfogel commented 7 years ago

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.