Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-22466

Bamboo Remote and Elastic Agent Jar installers do not bundle dependencies to allow custom Log4j2 settings

XMLWordPrintable

      Issue Summary

      This is reproducible on Data Center:

      Bamboo Remote Agent Jar installer does not bundle dependencies to allow Log4j2 settings. That means in case a log4j2.properties file is configured via wrapper.java.additional.4=-Dlog4j2.configurationFile, Bamboo will fail to load basic packages such as BambooRollingFile

      Steps to Reproduce

      1. Install a Remote Agent via the provided Jar installer
      2. Stop the Agent
      3. Configure a custom log4j2.properties file by following the instructions in:
      4. The same is applicable if running an Elastic Agent with custom log settings

      Expected Results

      Custom logging should work as expected

      Actual Results

      • The inner functions of the Agent still work, but no further logs are reported. That is, the Agent still works in the dark.
      • The initial Agent bootstrap (from lib/bamboo-agent-bootstrap or lib/wrapper.jar starts and reports several errors and logging does not work due to missing classes.
        STATUS | wrapper  | 2023/08/26 22:51:01 | Launching a JVM...
        Waiting for Bamboo Agent....INFO   | jvm 1    | 2023/08/26 22:51:01 | WrapperManager: Initializing...
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,439 WrapperSimpleAppMain ERROR Unable to locate plugin type for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,442 WrapperSimpleAppMain ERROR Unable to locate plugin type for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,442 WrapperSimpleAppMain ERROR Unable to locate plugin type for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,442 WrapperSimpleAppMain ERROR Unable to locate plugin type for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,535 WrapperSimpleAppMain ERROR Unable to locate plugin for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,559 WrapperSimpleAppMain ERROR Unable to locate plugin for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,565 WrapperSimpleAppMain ERROR Unable to locate plugin for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,566 WrapperSimpleAppMain ERROR Unable to locate plugin for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,567 WrapperSimpleAppMain ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.config.AppendersPlugin for element Appenders: java.lang.NullPointerException java.lang.NullPointerException
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:52)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:264)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:137)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1122)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1047)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:651)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:249)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:295)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:694)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:711)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:253)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:599)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at com.atlassian.bamboo.agent.bootstrap.RemoteAgentBootstrap.<clinit>(RemoteAgentBootstrap.java:30)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/java.lang.Class.forName0(Native Method)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/java.lang.Class.forName(Class.java:315)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.main(AgentBootstrap.java:18)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:349)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/java.lang.Thread.run(Thread.java:829)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,569 WrapperSimpleAppMain ERROR Unable to locate appender "accesslog" for logger config "com.atlassian.bamboo.filter.AccessLogFilter"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,569 WrapperSimpleAppMain ERROR Unable to locate appender "console" for logger config "com.atlassian.bamboo.filter.AccessLogFilter"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,576 WrapperSimpleAppMain ERROR Unable to locate appender "console" for logger config "root"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,576 WrapperSimpleAppMain ERROR Unable to locate appender "filelog" for logger config "root"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,577 WrapperSimpleAppMain ERROR Unable to locate appender "emergency" for logger config "emergency"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,577 WrapperSimpleAppMain ERROR Unable to locate appender "javascript" for logger config "JavaScript"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,613 WrapperSimpleAppMain ERROR Unable to locate plugin type for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,613 WrapperSimpleAppMain ERROR Unable to locate plugin type for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,613 WrapperSimpleAppMain ERROR Unable to locate plugin type for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,614 WrapperSimpleAppMain ERROR Unable to locate plugin type for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,630 WrapperSimpleAppMain ERROR Unable to locate plugin for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,634 WrapperSimpleAppMain ERROR Unable to locate plugin for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,636 WrapperSimpleAppMain ERROR Unable to locate plugin for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,637 WrapperSimpleAppMain ERROR Unable to locate plugin for BambooRollingFile
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,638 WrapperSimpleAppMain ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.config.AppendersPlugin for element Appenders: java.lang.NullPointerException java.lang.NullPointerException
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:52)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:264)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:137)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1122)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1047)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:651)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:249)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:295)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:694)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.apache.logging.log4j.core.LoggerContext.setConfigLocation(LoggerContext.java:679)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at com.atlassian.bamboo.agent.bootstrap.RemoteAgentBootstrap.configureLogging(RemoteAgentBootstrap.java:78)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at com.atlassian.bamboo.agent.bootstrap.RemoteAgentBootstrap.main(RemoteAgentBootstrap.java:41)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.main(AgentBootstrap.java:21)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:349)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 	at java.base/java.lang.Thread.run(Thread.java:829)
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,641 WrapperSimpleAppMain ERROR Unable to locate appender "accesslog" for logger config "com.atlassian.bamboo.filter.AccessLogFilter"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,641 WrapperSimpleAppMain ERROR Unable to locate appender "console" for logger config "com.atlassian.bamboo.filter.AccessLogFilter"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,642 WrapperSimpleAppMain ERROR Unable to locate appender "console" for logger config "root"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,642 WrapperSimpleAppMain ERROR Unable to locate appender "filelog" for logger config "root"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,642 WrapperSimpleAppMain ERROR Unable to locate appender "emergency" for logger config "emergency"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,642 WrapperSimpleAppMain ERROR Unable to locate appender "javascript" for logger config "JavaScript"
        INFO   | jvm 1    | 2023/08/26 22:51:02 | 2023-08-26 22:51:02,731 ERROR [WrapperSimpleAppMain] [RemoteAgentBootstrap] LOG4J: Custom configuration at /home/bamboo/bamboo-agent-home-923/conf/log4j2.properties is invalid, using defaults
        

      Workaround

      Remote Agent / Ephemeral Agent

      Add the following entries to the <bamboo-agent-home>/conf/wrapper.conf to make the Tanuki Wrapper load extra libraries enough to satisfy the Log4j2 dependencies. Then restart the Agent.

      wrapper.java.classpath.3=../classpath/*.jar
      

      Elastic Agent

      Due to the way the Elastic Agent bootstraps by loading an initial bootstrap embedded in the installer script, the wrapper.conf file can't be overwritten so the extra classpath can't be added. Hence no workaround exists for an Elastic Agent.

              0e9420ab33a9 Sylwester Jeruzal
              73868399605e Eduardo Alvarenga
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: