Message Boards

Starting liferay with elastic's apm outputs errors

Catalin T, modified 3 Years ago.

Starting liferay with elastic's apm outputs errors

New Member Posts: 3 Join Date: 8/10/20 Recent Posts
Hello,
I've tried to start the liferay application together with the Elastic's APM agent.The application is starting eventually(it takes a bit longer) , however, it outputs some errors in the catalina.out.
This is my setenv.sh file
Logs without the agent started
Logs with the agent started
After the app is started, even the GET/POST requests are visible in Kibana->APM, however, I would very much like to solve the errors.Can you help me guys?Many thanks,
Catalin
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Starting liferay with elastic's apm outputs errors

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
Why don't you start Elasticsearch in an extra process, completely unrelated from Liferay and configure the remote ES service then in Liferay?
It is the recommended way and you shouldn't face these issues in that setup.
https://help.liferay.com/hc/en-us/articles/360018175651-Configuring-Elasticsearch
Catalin T, modified 3 Years ago.

RE: Starting liferay with elastic's apm outputs errors

New Member Posts: 3 Join Date: 8/10/20 Recent Posts
Hi Christoph,First of all, thanks for replying to my thread.
The article mentioned earlier reffers to the elasticsearch componenet, however I am looking to use APM agent component.
So basically, once I start the liferay app, there's an extra JAR file started, the APM agent.
This is being done by modifying the tomcat's setEnv.sh file, adding -javaagent:elastic-apm-agent-1.18.0.RC1.jar to the CATALINA_OPTS variable.Many thanks,
Catalin
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: Starting liferay with elastic's apm outputs errors

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
I see.
Maybe you have to ask this in an Elasticsearch forum since the error is APM related. And since it is that early, it might not be even Liferay related. What happens when you attach the agent to a normal tomcat, without Liferay on the same server? Should be easy to test.
If it works, I would try to compare the conf/ folders, especially logging.properties since the error seems to be somehow related to logging.
thumbnail
Jorge Diaz, modified 3 Years ago.

RE: Starting liferay with elastic's apm outputs errors

Liferay Master Posts: 753 Join Date: 1/9/14 Recent Posts
Hi Catalin,
OSGI environment can cause some problems to the APM applications because it hides the global java packages from its internal classloaders.
To avoid this issues, you have also to configure Elastic APM packages (co.elastic.apm.agent.*) in the  OSGI bootdelegation  properties module.framework.properties.org.osgi.framework.bootdelegation  in the portal-ext.properties file
That will allow Elastic APM to be accessed from all OSGI classloaders:
  1. Copy default value of module.framework.properties.org.osgi.framework.bootdelegation  property from portal.properties file to portal-ext.properties
  2. Add co.elastic.apm.agent.* at the end of it.
More information see also this post of David Nebinger: https://liferay.dev/blogs/-/blogs/liferay-ce-7-x-liferay-dxp-7-x-java-agents
Catalin T, modified 3 Years ago.

RE: Starting liferay with elastic's apm outputs errors

New Member Posts: 3 Join Date: 8/10/20 Recent Posts
Hi Jorge,I have added the co.elastic.apm.agent.* at the end of the portal-ext.properties file.
No more errors so far, except the following:
"2020-08-13 07:18:09,793 main ERROR No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2"
But, most probably this can be changed in tomcat's config.
Thank you very much for your help!
I really appreciate it.

Regards,
Catalin