I'm using Logback/SLF4J to do logging, and it works like a charm on my Mac development machine.
I have the following pattern used for mail appender subject:
<subject>[ERROR] ${HOSTNAME} : %msg</subject>
When running the service on my Mac, I receive a subject like this:
macbook-pro.localhost : Error message
When I run the service on a Debian (Lenny) VPS, I get the following email subject
HOSTNAME_IS_UNDEFIENED : Error message
Typing hostname
in command line for both Mac and Debian machine produces the following:
mac: macbook-pro.localhost
debian: s1.myservice.com
I'd like to see the s1.myservice.com
in email subject.
Logback gets the value of HOSTNAME with InetAddress.getLocalHost().getHostName(). Check what the following code prints on your server:
import java.net.*;
final InetAddress localHost = InetAddress.getLocalHost();
System.out.println("hostAddress: " + localHost.getHostAddress());
System.out.println("hostName: " + localHost.getHostName());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With