Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Use FQDN if possible. #32

Merged
merged 2 commits into from
May 18, 2014
Merged

Use FQDN if possible. #32

merged 2 commits into from
May 18, 2014

Conversation

burberius
Copy link

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.

@Moocar
Copy link
Owner

Moocar commented Apr 2, 2014

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.

@burberius
Copy link
Author

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.

@Moocar Moocar merged commit 2c1c134 into Moocar:master May 18, 2014
@Moocar
Copy link
Owner

Moocar commented May 18, 2014

Thanks for this, I updated the docstring for getLocalHostName and added a private isFQDN function to make it a bit more readable. Merged!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants