Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-749

Failed to get local hostname

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.0.12
    • 1.0.6, 1.0.7
    • None
    • None
    • OS X 10.8.1

    Description

      This might be a won't-fix.

      If the HostName (`scutil --get HostName`) contains a whitespace the, logback will throw an error

      ```
      20:04:52,128 |-ERROR in ch.qos.logback.core.util.ContextUtil@36b37b66 - Failed to get local hostname java.net.UnknownHostException: MacBook Pro: MacBook Pro: nodename nor servname provided, or not known
      at java.net.UnknownHostException: MacBook Pro: MacBook Pro: nodename nor servname provided, or not known
      at at java.net.InetAddress.getLocalHost(InetAddress.java:1438)
      at at ch.qos.logback.core.util.ContextUtil.getLocalHostName(ContextUtil.java:32)
      at at ch.qos.logback.core.util.ContextUtil.addHostNameAsProperty(ContextUtil.java:41)
      at at ch.qos.logback.classic.joran.action.ConfigurationAction.begin(ConfigurationAction.java:56)
      at at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:276)
      at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:148)
      at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:130)
      at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:157)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:143)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:106)
      at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:56)
      at at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
      at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148)
      at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
      at at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54)
      at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
      at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
      at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
      at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
      at at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
      at at com.srhub.nscrg.core.SpellsParserTest.<init>(SpellsParserTest.java:46)
      at at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
      at at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:187)
      at at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:236)
      at at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      at at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:233)
      at at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
      at at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
      at at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      at at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      at at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      at at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      at at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      at at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      at at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      at at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      at at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: java.net.UnknownHostException: MacBook Pro: nodename nor servname provided, or not known
      at at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
      at at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866)
      at at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258)
      at at java.net.InetAddress.getLocalHost(InetAddress.java:1434)
      at ... 43 common frames omitted
      ```

      I don't even know if this is allowed [1] but OSX allows setting the HostName it directly via `scutil --set HostName "MacBook Pro"`

      [1] http://tools.ietf.org/html/rfc952

      Attachments

        Activity

          People

            logback-dev Logback dev list
            oschrenk Oliver Schrenk
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: