openmrs-core: replace log4j 1 which is EOL

Hi Mark,

Regarding simple log.info("message") expressions

If every module makes sure that they only use the slf4j API to log messages than it would not need to worry about what logging implementation openmrs-core uses as implementation. So no compatibility changes from before/after. The slf4j facade lib is already in openmrs-core. I dont know why it is not used exclusively (see clean up logging).

One caveat: slf4j does not support the log level FATAL. So it does not provide log.fatal() and thus such calls have to be changed into info.error("message", exception) or using markers info.error(MarkerFactory.getMarker("FATAL"), "message", exception)

see https://www.slf4j.org/faq.html#fatal

log4j.xml

I see that the https://wiki.openmrs.org/display/docs/Module+Conventions discourages modules from adding a log4j.xml (except for testing) so they dont override the cores config. So I hope that nobody did that :wink:

Changing logging configuration programmatically

If modules do change logging config via log4j 1 APIs than this is of course this can be an issue.

Ill try out the bridge from log4j 1 to 2 https://logging.apache.org/log4j/2.0/log4j-1.2-api/ which @raff pointed me to, this might help.

But if you have example modules for me which do more than just call log.info/debug/… please tell me and I’ll check what this would mean for them!