Logging in dhis2-live

For those of you who are using dhis2-live you might have been
frustrated to discover that log4j.properties in WEB-INF/classes is
being ignored.

After much searching I discovered that dhis2-live has a
log4j.properties file in the dhis2-live.jar which is the one that is
used. Of course I should have known that because I put it there, but
it was a long time ago :frowning: It is there to ensure the logs get written
to the right directory and to make jetty happy.

Anyway lessons learned:

1. If you ever find looking for a file in an endless sea of jars you
can try this:

for f in $(find . -iname '*.jar'); do echo looking for
log4j.properties in $f; unzip -t $f;done |grep log4j.properties

Assuming you have bash and find and unzip and grep of course.

2. If you are debugging with dhis2-live and want to customize the log
level: eg I wanted to append the line

log4j.category.org.hisp.dhis.importexport= DEBUG

Just poke your custom log4j.properties into the jar like this:

zip dhis2-live.jar log4j.properties

We live and we learn ....

Bob