Fixes #672 - Allow logging configuration announcement to be programmatically disabled

This commit is contained in:
Joakim Erdfelt 2016-06-28 13:01:16 -07:00
parent 225c6a8086
commit b20e2ddf18
1 changed files with 21 additions and 4 deletions

View File

@ -167,13 +167,18 @@ public class Log
return;
__initialized = true;
Boolean announce = Boolean.parseBoolean(__props.getProperty("org.eclipse.jetty.util.log.announce", "true"));
try
{
Class<?> log_class = __logClass==null?null:Loader.loadClass(Log.class, __logClass);
if (LOG == null || (log_class!=null && !LOG.getClass().equals(log_class)))
{
LOG = (Logger)log_class.newInstance();
LOG.debug("Logging to {} via {}", LOG, log_class.getName());
if(announce)
{
LOG.debug("Logging to {} via {}", LOG, log_class.getName());
}
}
}
catch(Throwable e)
@ -182,8 +187,10 @@ public class Log
initStandardLogging(e);
}
if (LOG!=null)
LOG.info(String.format("Logging initialized @%dms",Uptime.getUptime()));
if (announce && LOG!=null)
{
LOG.info(String.format("Logging initialized @%dms", Uptime.getUptime()));
}
}
}
@ -199,7 +206,12 @@ public class Log
{
log_class = StdErrLog.class;
LOG = new StdErrLog();
LOG.debug("Logging to {} via {}", LOG, log_class.getName());
Boolean announce = Boolean.parseBoolean(__props.getProperty("org.eclipse.jetty.util.log.announce", "true"));
if(announce)
{
LOG.debug("Logging to {} via {}", LOG, log_class.getName());
}
}
}
@ -322,4 +334,9 @@ public class Log
{
return Collections.unmodifiableMap(__loggers);
}
public static Properties getProperties()
{
return __props;
}
}