# Unable to generate log file for Elastic Java agent

**URL:** <https://discuss.elastic.co/t/unable-to-generate-log-file-for-elastic-java-agent/359428>\
**Category:** APM\
**Tags:** docker, java\
**Created:** [May 14, 2024, 6:48am UTC](https://discuss.elastic.co/t/unable-to-generate-log-file-for-elastic-java-agent/359428 "2024-05-14T06:48:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Namita\_Jaokar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/namita_jaokar/32/104106_2.png) [@Namita\_Jaokar](https://discuss.elastic.co/u/Namita_Jaokar)\
**Post date:** [May 14, 2024, 6:48am UTC](https://discuss.elastic.co/t/unable-to-generate-log-file-for-elastic-java-agent/359428/1 "2024-05-14T06:48:29Z")

</div>

Hi,

I am using elastic java agent 1.49 for tracing a containerized application with docker.  
I have some spans being dropped out and to debug the same, Enabled the logs to trace mode for the agent.

However , I am unable to generate the logs file for the agent. below are the combination of properties I have tried out:

1. -Delastic.apm.log\_level=trace -Delastic.apm.log\_file=./logs/elastic-apm.log
2. -Delastic.apm.log\_level=trace -Delastic.apm.log\_file=_AGENT\_HOME_/logs/elastic-apm.log
3. -Delastic.apm.log\_level=trace -Delastic.apm.log\_file=_AGENT\_HOME_/elastic-apm.log
4. -Delastic.apm.log\_level=trace -Delastic.apm.log\_file=$\_AGENT\_HOME/logs/elastic-apm.log

None of the above generated the log file. Tried giving full permissions to the path as well.

Am i missing any other configurations required with the log properties mentioned above or Is there any other way to get the agent logs in a file system.

Kindly advise.

Thanks & Regards,  
Namita Jaokar

---

<div class="post-metadata">

**Author:** ![Jack\_Shirazi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jack_shirazi/32/91641_2.png) [@Jack\_Shirazi](https://discuss.elastic.co/u/Jack_Shirazi)\
**Post date:** [May 14, 2024, 12:30pm UTC](https://discuss.elastic.co/t/unable-to-generate-log-file-for-elastic-java-agent/359428/2 "2024-05-14T12:30:47Z")

</div>

[docs](https://www.elastic.co/guide/en/apm/agent/java/current/config-logging.html#config-log-file)

> The special value `_AGENT_HOME_` is a placeholder for the folder the elastic-apm-agent.jar is in. Example: `_AGENT_HOME_/logs/elastic-apm.log`

---

<div class="post-metadata">

**Author:** ![Namita\_Jaokar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/namita_jaokar/32/104106_2.png) [@Namita\_Jaokar](https://discuss.elastic.co/u/Namita_Jaokar)\
**Post date:** [May 14, 2024, 1:53pm UTC](https://discuss.elastic.co/t/unable-to-generate-log-file-for-elastic-java-agent/359428/3 "2024-05-14T13:53:21Z")

</div>

Hi @Jack_Shirazi ,

Thankyou for your response.  
Correction from my previous comment , the editor took it the special character "\_" from the `_AGENT_HOME_` as an italic formatter and hence the typo.

I had provided `_AGENT_HOME_` in the property configuration , referring to the same link that you have provided but unfortunately it does not work for me.

is there anything i am missing on.

Best Regards,  
Namita Jaokar

---

<div class="post-metadata">

**Author:** ![Jack\_Shirazi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jack_shirazi/32/91641_2.png) [@Jack\_Shirazi](https://discuss.elastic.co/u/Jack_Shirazi)\
**Post date:** [May 15, 2024, 8:32am UTC](https://discuss.elastic.co/t/unable-to-generate-log-file-for-elastic-java-agent/359428/4 "2024-05-15T08:32:42Z")

</div>

To be clear, you are running in the docker image and you are building the image with those parameters and when you run the image you interactively shell into the image and look in the image directory where the jar is and it's not there? And you've checked the write perms to that directory for the user the JVM is running under?

---

<div class="post-metadata">

**Author:** ![Namita\_Jaokar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/namita_jaokar/32/104106_2.png) [@Namita\_Jaokar](https://discuss.elastic.co/u/Namita_Jaokar)\
**Post date:** [May 15, 2024, 8:54am UTC](https://discuss.elastic.co/t/unable-to-generate-log-file-for-elastic-java-agent/359428/5 "2024-05-15T08:54:27Z")

</div>

yes, Its not there in the jar directory and neither is the agent jar. Have given permissions to the directory and tried as well.

Best Regards,  
Namita

---

<div class="post-metadata">

**Author:** ![Jack\_Shirazi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jack_shirazi/32/91641_2.png) [@Jack\_Shirazi](https://discuss.elastic.co/u/Jack_Shirazi)\
**Post date:** [May 15, 2024, 10:35am UTC](https://discuss.elastic.co/t/unable-to-generate-log-file-for-elastic-java-agent/359428/6 "2024-05-15T10:35:44Z")

</div>

What does the docker output show? There would be error output of some kind
