Closed burberius closed 10 years ago
Hi, this would be a breaking change to existing users. E.g on my mac:
InetAddress.getLocalHost.getHostName() => "guerrero.homeoffice.wal-mart.com"
InetAddress.getLocalHost.getCanonicalHostName() => "192.168.1.126"
I would recommend adding a property that can be configured in logback.xml. E.g hostNameMechanism = getCanonicalHostName.
I changed it now, to use the CanonicalHostName only when it's a FQDN else use HostName, so it's the old behaviour. I don't want to added another property for such a little cosmetic change. ;-) There is also a Test for that now.
Thanks for this, I updated the docstring for getLocalHostName
and added a private isFQDN
function to make it a bit more readable. Merged!
I have the problem that some systems are logged with their hostname only and others with the FQDN in our Graylog2. We have a test and a live net, which can be distinguished by their subdomain and I need that to separate the logging. I did some tests with the getCanonicalHostName method on different systems and it always gave the FQDN, so that is the right solution for us. It would be nice if that could be integrated in the next release.