Access ActiveMQ Jetty logs with Java service wrapper

76 views Asked by At

I have ActiveMQ returning a 503 for certain endpoints in the UI. However, none of the Jetty logs are being displayed in the console.

I'm using a Java service wrapper to run ActiveMQ. It seems to be completely ignoring the Log4j config, but I am not sure why.

My wrapper config is:

# wrapper.debug=TRUE
set.default.ACTIVEMQ_HOME=../..
set.default.ACTIVEMQ_BASE=../..
set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf
set.default.ACTIVEMQ_DATA=%ACTIVEMQ_BASE%/data
wrapper.working.dir=.

# Java Application
wrapper.java.command=java

wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
wrapper.java.classpath.1=%ACTIVEMQ_HOME%/bin/wrapper.jar
wrapper.java.classpath.2=%ACTIVEMQ_HOME%/bin/activemq.jar

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=%ACTIVEMQ_HOME%/bin/win64

# Java Additional Parameters
# note that n is the parameter number starting from 1.
wrapper.java.additional.1=-Dactivemq.home="%ACTIVEMQ_HOME%"
wrapper.java.additional.2=-Dactivemq.base="%ACTIVEMQ_BASE%"
wrapper.java.additional.3=-Djavax.net.ssl.keyStorePassword=<redacted>
wrapper.java.additional.4=-Djavax.net.ssl.trustStorePassword=<redacted>
wrapper.java.additional.5=-Djavax.net.ssl.keyStore="%ACTIVEMQ_CONF%/<keystore>"
wrapper.java.additional.6=-Djavax.net.ssl.trustStore="%ACTIVEMQ_CONF%/<keystore>"
wrapper.java.additional.7=-Dorg.apache.activemq.UseDedicatedTaskRunner=false
wrapper.java.additional.8=-Dlog4j.configuration.file="%ACTIVEMQ_CONF%/log4j.properties"
wrapper.java.additional.9=-Dactivemq.conf="%ACTIVEMQ_CONF%"
wrapper.java.additional.10=-Dactivemq.data="%ACTIVEMQ_DATA%"

# Hawtio config
wrapper.java.additional.11=-Djava.security.auth.login.config="%ACTIVEMQ_CONF%/login.config"
#LP: Turn off authentication as the Hawtio people have decided to block Jolokia access unless the session has already been authenticated.
wrapper.java.additional.12=-Dhawtio.authenticationEnabled=false
#JC: Add offline flag to hawtio else it tries to contact Gibhub for various configs
wrapper.java.additional.13=-Dhawtio.offline=true
#JC: Add proxy whitelist to * to revert to pre-1.5 behaviour of all hosts allowed to access. Defaults to localhost etc
wrapper.java.additional.14=-Dhawtio.proxyWhitelist=*

wrapper.java.additional.15=-Dhawtio.realm=activemq
wrapper.java.additional.16=-Dhawtio.role=admins
wrapper.java.additional.17=-javaagent:%ACTIVEMQ_BASE%/lib/jmx_prometheus_javaagent-0.19.0.jar=7070:jmx_exporter.yaml

# JMX Config
wrapper.java.additional.18=-Dcom.sun.management.jmxremote
wrapper.java.additional.19=-Dcom.sun.management.jmxremote.port=1616
wrapper.java.additional.20=-Dcom.sun.management.jmxremote.authenticate=false
wrapper.java.additional.21=-Dcom.sun.management.jmxremote.ssl=false
wrapper.java.additional.22=-Dcom.sun.management.jmxremote.local.only=true

# Initial Java Heap Size (in MB)
#wrapper.java.initmemory=3

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=2048

# Application parameters.  Add parameters as needed starting from 1
wrapper.app.parameter.1=org.apache.activemq.console.Main
wrapper.app.parameter.2=start
wrapper.app.parameter.3=xbean:activemq_live_events_int.xml

wrapper.console.format=PM

# Log Level for console output.  (See docs for log levels)
wrapper.console.loglevel=INFO

# Log file to use for wrapper output logging.
wrapper.logfile=%ACTIVEMQ_DATA%/wrapper.log
# Format of output for the log file.  (See docs for formats)
wrapper.logfile.format=LPTM

# Log Level for log file output.  (See docs for log levels)
wrapper.logfile.loglevel=INFO

wrapper.logfile.maxsize=10m
wrapper.logfile.maxfiles=10
wrapper.syslog.loglevel=NONE

wrapper.console.title=ActiveMQ
wrapper.ntservice.name=ActiveMQ
wrapper.ntservice.displayname=ActiveMQ
wrapper.ntservice.description=ActiveMQ Broker
wrapper.ntservice.dependency.1=

wrapper.ntservice.starttype=AUTO_START

wrapper.ntservice.interactive=false

wrapper.ntservice.account=<redacted>
wrapper.ntservice.password=<redacted>

The console output is just the JVM status. It doesn't show any of the access logs from Jetty in the UI. This is just running on localhost. For now the port is the standard 8161.

Is there a way to append the Jetty logs to this console output?

Tried editing log4j.properties, logging.properties by adding wrapper.java.additional.8=-Dlog4j.configuration.file="%ACTIVEMQ_CONF%/log4j.properties".

1

There are 1 answers

1
clg On BEST ANSWER

Managed to get this working; created the filejetty-logging.properties with the following config:

org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdOutLog
org.eclipse.jetty.LEVEL=INFO