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

Use FQDN if possible. - #32

Merged
Moocar merged 2 commits into
Moocar:masterfrom
burberius:master
May 18, 2014
Merged

Moocar merged 2 commits into
Moocar:masterfrom
burberius:master

Conversation

@burberius

Copy link
Copy Markdown

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

Moocar commented Apr 2, 2014

Copy link
Copy Markdown
Owner

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
Copy Markdown
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

Moocar commented May 18, 2014

Copy link
Copy Markdown
Owner

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.

2 participants