For my application logs for a REST server, I'd like to log some details about each http request. I'm using sl4j. Should I use logger.debug or logger.info
More generally what sort of things should be logged in logger.info?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.Sign up to join this community
https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html defines the intended meanings of the levels and also explains that the ordering is OFF, FATAL, ERROR, WARN, INFO, DEBUG and ALL.
informational messages that highlight the progress of the application at coarse-grained level.. This sounds like what you are describing; you want to know what happened in the normal run of events
fine-grained informational events that are most useful to debug an application.. I reserve this for debugging, ie. something has gone wrong and you need to log something fine-grained, not just the error. I find it rare to put this in at the beginning of a code-base and more likely to go into a patch-release if an unreproducible issue is occurring in an environment. But if you can anticipate those kind of errors and what fine-grained information you require, maybe you would use this.
As always be aware of the cost of logging (both disk-space and how sometimes the more you log, the more it can obscure real errors)