Skip to contentSkip to conversation

Fix: build log4j example when enabled

PATCH Mathieu Desnoyers 1 participant 1 message Jun 25, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Merged in master and stable-2.6, thanks!

Mathieu

Quoted 131 lines · ----- On Jun 25, 2015, at 5:13 PM, Michael Jeanson [email protected] wrote:

---

.gitignore                      |  2 +-
doc/examples/Makefile.am        | 26 +++++++++++++++++++++++---
doc/examples/java-jul/run       |  3 ++-
doc/examples/java-log4j/.intree |  0
doc/examples/java-log4j/run     |  5 +++--
5 files changed, 29 insertions(+), 7 deletions(-)

create mode 100644 doc/examples/java-log4j/.intree

.gitignore +1 -1
index 166a260..6ff01a4 100644
@@ -54,7 +54,7 @@ tests/benchmark/bench2
 
 # Java agent library
 *.class
-liblttng-ust-agent.jar
+liblttng-ust-agent*.jar

classnoinst.stamp
jni-header.stamp
jul-jni-header.stamp

doc/examples/Makefile.am +0 -0
index 0d22602..9404054 100644
@@ -8,7 +8,7 @@ doc_examples_demo_tracelogdir = ${docdir}/examples/demo-tracelog

doc_examples_clock_overridedir = ${docdir}/examples/clock-override doc_examples_getcpu_overridedir = ${docdir}/examples/getcpu-override

doc/examples/Makefile.am +1 -1
-if BUILD_JAVA_AGENT
+if BUILD_JAVA_AGENT_WITH_JUL

doc_examples_java_juldir = ${docdir}/examples/java-jul

dist_doc_examples_java_jul_DATA = java-jul/Makefile \
				  java-jul/Hello.java \
doc/examples/Makefile.am +0 -0
@@ -16,6 +16,14 @@ dist_doc_examples_java_jul_DATA = java-jul/Makefile \

SUBDIRS_JUL = java-jul
endif

doc/examples/Makefile.am +8 -0
+if BUILD_JAVA_AGENT_WITH_LOG4J
+doc_examples_java_log4jdir = ${docdir}/examples/java-log4j
+dist_doc_examples_java_log4j_DATA = java-log4j/Makefile \
+				  java-log4j/Hello.java \
+				  java-log4j/run
+SUBDIRS_LOG4J = java-log4j
+endif
+

dist_doc_examples_DATA = README

dist_doc_examples_easy_ust_DATA = easy-ust/Makefile \

doc/examples/Makefile.am +0 -0
@@ -74,7 +82,7 @@ endif
 

all-local:

	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
doc/examples/Makefile.am +1 -1
-		for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL); do \
+		for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL) $(SUBDIRS_LOG4J); do \
			cp -pfR $(srcdir)/$$subdir $(builddir); \
		done; \
	fi; \
doc/examples/Makefile.am +4 -0
@@ -99,6 +107,11 @@ all-local:
 		for subdir in $(SUBDIRS_JUL); do \
 			(cd $(SUBDIRS_JUL) && $(MAKE)
 			JAVA_CLASSPATH_OVERRIDE="../../../liblttng-ust-java-agent/java"
 			JAVA_JARFILE_OVERRIDE="liblttng-ust-agent.jar" $(AM_MAKEFLAGS) all && cd ..) ||
 			exit 1; \
 		done; \
+	fi; \
+	if [ x"$(SUBDIRS_LOG4J)" != x"" ]; then \
+		for subdir in $(SUBDIRS_LOG4J); do \
+			(cd $(SUBDIRS_LOG4J) && $(MAKE)

JAVA_CLASSPATH_OVERRIDE="../../../liblttng-ust-java-agent/java" JAVA_JARFILE_OVERRIDE="liblttng-ust-agent.jar" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \

doc/examples/Makefile.am +1 -0
+		done; \
	fi;

clean-local:

doc/examples/Makefile.am +8 -1
@@ -114,8 +127,15 @@ clean-local:
 			fi; \
 		done; \
 	fi; \
+	if [ x"$(SUBDIRS_LOG4J)" != x"" ]; then \
+		for subdir in $(SUBDIRS_LOG4J); do \
+			if [ -d $$subdir ]; then \
+				(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) clean && cd ..) || exit 1; \
+			fi; \
+		done; \
+	fi; \
 	if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-		for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL); do \
+		for subdir in $(SUBDIRS_PROXY) $(SUBDIRS_JUL) $(SUBDIRS_LOG4J); do \
 			rm -rf $(builddir)/$$subdir; \
 		done; \
 	fi;
doc/examples/java-jul/run +0 -0
index 1beac85..37a3cfd 100755
@@ -16,7 +16,8 @@ if [ -f "$DIR/.intree" ]; then
 	LIBPATH="../../../liblttng-ust-java-agent/jni/jul/.libs"

else
CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE"

doc/examples/java-jul/run +2 -1
-	LIBPATH="/usr/local/lib:/usr/lib"
+	# Use system defined java.library.path
+	#LIBPATH="/usr/local/lib:/usr/lib"

fi

java -classpath "$CLASSPATH:." -Djava.library.path="$LIBPATH" Hello

doc/examples/java-log4j/.intree new file +0 -0
new file mode 100644
index 0000000..e69de29
doc/examples/java-log4j/run +0 -0
index 128725f..5e3cbeb 100755
@@ -17,9 +17,10 @@ if [ -f "$DIR/.intree" ]; then
 	LIBPATH="../../../liblttng-ust-java-agent/jni/log4j/.libs"

else
CLASSPATH="/usr/local/share/java/$JARFILE:/usr/share/java/$JARFILE:$LOG4J"

doc/examples/java-log4j/run +2 -1
-	LIBPATH="/usr/local/lib:/usr/lib"
+	# Use system defined java.library.path
+	#LIBPATH="/usr/local/lib:/usr/lib"

fi

doc/examples/java-log4j/run +1 -1
-java -classpath "$CLASSPATH:." Hello
+java -classpath "$CLASSPATH:." -Djava.library.path="$LIBPATH" Hello

cd -
--
1.9.1

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com