Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project
This commit is contained in:
commit
d4603e1fdd
|
@ -228,6 +228,10 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector
|
|||
@Override
|
||||
protected void connectionFailed(SocketChannel channel, Throwable ex, Object attachment)
|
||||
{
|
||||
Timeout.Task connectTimeout = _connectingChannels.remove(channel);
|
||||
if (connectTimeout != null)
|
||||
connectTimeout.cancel();
|
||||
|
||||
if (attachment instanceof HttpDestination)
|
||||
((HttpDestination)attachment).onConnectionFailed(ex);
|
||||
else
|
||||
|
|
|
@ -141,27 +141,44 @@ public class StdErrLog implements Logger
|
|||
}
|
||||
else
|
||||
{
|
||||
if ("ALL".equalsIgnoreCase(levelStr.trim()))
|
||||
int level = getLevelId(levelStr);
|
||||
if (level != (-1))
|
||||
{
|
||||
return LEVEL_ALL;
|
||||
}
|
||||
else if ("DEBUG".equalsIgnoreCase(levelStr.trim()))
|
||||
{
|
||||
return LEVEL_DEBUG;
|
||||
}
|
||||
else if ("INFO".equalsIgnoreCase(levelStr.trim()))
|
||||
{
|
||||
return LEVEL_INFO;
|
||||
}
|
||||
else if ("WARN".equalsIgnoreCase(levelStr.trim()))
|
||||
{
|
||||
return LEVEL_WARN;
|
||||
return level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Default Logging Level
|
||||
return LEVEL_INFO;
|
||||
return getLevelId(props.getProperty("log.LEVEL", "INFO"));
|
||||
}
|
||||
|
||||
protected static int getLevelId(String levelName)
|
||||
{
|
||||
if (levelName == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
String levelStr = levelName.trim();
|
||||
if ("ALL".equalsIgnoreCase(levelStr))
|
||||
{
|
||||
return LEVEL_ALL;
|
||||
}
|
||||
else if ("DEBUG".equalsIgnoreCase(levelStr))
|
||||
{
|
||||
return LEVEL_DEBUG;
|
||||
}
|
||||
else if ("INFO".equalsIgnoreCase(levelStr))
|
||||
{
|
||||
return LEVEL_INFO;
|
||||
}
|
||||
else if ("WARN".equalsIgnoreCase(levelStr))
|
||||
{
|
||||
return LEVEL_WARN;
|
||||
}
|
||||
|
||||
System.err.println("Unknown StdErrLog level [" + levelStr + "], expecting only [ALL, DEBUG, INFO, WARN] as values.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,6 +78,19 @@ public class StdErrLogTest
|
|||
Assert.assertEquals("Default Logging Level",StdErrLog.LEVEL_INFO,StdErrLog.getLoggingLevel(props,StdErrLogTest.class.getName()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetLoggingLevel_Root()
|
||||
{
|
||||
Properties props = new Properties();
|
||||
props.setProperty("log.LEVEL","DEBUG");
|
||||
|
||||
// Default Levels
|
||||
Assert.assertEquals("Default Logging Level",StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,null));
|
||||
Assert.assertEquals("Default Logging Level",StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,""));
|
||||
Assert.assertEquals("Default Logging Level",StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty"));
|
||||
Assert.assertEquals("Default Logging Level",StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,StdErrLogTest.class.getName()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetLoggingLevel_FQCN()
|
||||
{
|
||||
|
@ -117,20 +130,21 @@ public class StdErrLogTest
|
|||
public void testGetLoggingLevel_MixedLevels()
|
||||
{
|
||||
Properties props = new Properties();
|
||||
props.setProperty("org.eclipse.jetty.util.LEVEL","DEBUG");
|
||||
props.setProperty("log.LEVEL","DEBUG");
|
||||
props.setProperty("org.eclipse.jetty.util.LEVEL","WARN");
|
||||
props.setProperty("org.eclipse.jetty.util.ConcurrentHashMap.LEVEL","ALL");
|
||||
|
||||
// Default Levels
|
||||
Assert.assertEquals(StdErrLog.LEVEL_INFO,StdErrLog.getLoggingLevel(props,null));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_INFO,StdErrLog.getLoggingLevel(props,""));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_INFO,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty"));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_INFO,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty.server.ServerObject"));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,null));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,""));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty"));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty.server.ServerObject"));
|
||||
|
||||
// Configured Level
|
||||
Assert.assertEquals(StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,StdErrLogTest.class.getName()));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty.util.MagicUtil"));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty.util"));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_DEBUG,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty.util.resource.FileResource"));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_WARN,StdErrLog.getLoggingLevel(props,StdErrLogTest.class.getName()));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_WARN,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty.util.MagicUtil"));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_WARN,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty.util"));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_WARN,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty.util.resource.FileResource"));
|
||||
Assert.assertEquals(StdErrLog.LEVEL_ALL,StdErrLog.getLoggingLevel(props,"org.eclipse.jetty.util.ConcurrentHashMap"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue