Delivery-focussed Elixir, Python, XSL/XQuery, (No)SQL, and Agile consultancy, specialising in content migration, API design, and (micro)services.

LinkedIn Octocat RSS

Log4j errors with thrift+java

We updated thrift recently and found that afterwards some Java code was raising errors. It turns out that the latest Thrift release/head requires log4j but doesn’t complain about it.

How we fixed it

Log4J can be obtained from:

$ curl {LOG4J_MIRROR}/apache-log4j-1.2.15.tar.gz | tar zx
$ mv apache-log4j-1.2.15 $JAVA_LIBS_DIR
$ ln $JAVA_LIBS_DIR/apache-log4j-1.2.15 \
$ ln $JAVA_LIBS_DIR/apache-log4j-latest/log4j-1.2.15.jar \

Then set $LOG4J_HOME to the above folder and add the $LOG4J_HOME/log4j.jar to your CLASSPATH.

$ cd ~/thrift
$ echo "thrift.extra.cpath = $JAVA_LIBS_DIR/apache-log4j-latest/log4j.jar" \
  > ~/
$ ./bootstrap
$ ./configure
$ make && make install

$JAVA_LIBS_DIR is where we keep all our java libraries (/opt/java/{pkg}).

Originally posted: Jul 06 2013