ppkarwasz commented on issue #1740:
URL: 
https://github.com/apache/logging-log4j2/issues/1740#issuecomment-1696138562

   @Roarca,
   Thanks for the report. The bug is easily reproducible if the system call 
`gethostname()` returns an unqualified host name.
   
   We use 
[`InetAddress#getLocalHost()`](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/net/InetAddress.html#getLocalHost())
 to retrieve the local hostname, which calls `gethostname()`, performs a lookup 
for the **fully qualified** hostname and **ignores** the result (cf. [source 
code](https://github.com/openjdk/jdk/blob/da75f3c4ad5bdf25167a3ed80e51f567ab3dbd01/src/java.base/unix/native/libnet/Inet4AddressImpl.c#L198)).
   
   This is why you see just `host` as hostname.
   
   As a workaround, you can change the hostname of the machine:
   ```sh
   hostname host.app.example
   ```
   It is not the UNIX way, but most services should work without any problems. 
You can also use 
[`uts_namespaces`](https://man7.org/linux/man-pages/man7/uts_namespaces.7.html) 
to isolate the hostname of your app from the rest of the system.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to