433483 sync log initialize

This commit is contained in:
Greg Wilkins 2014-04-25 14:22:57 +02:00
parent ce5af1d521
commit 15661722b3
1 changed files with 17 additions and 18 deletions

View File

@ -151,33 +151,32 @@ public class Log
public static void initialized() public static void initialized()
{ {
synchronized (Log.class) synchronized (Log.class)
{ {
if (__initialized) if (__initialized)
return; return;
__initialized = true; __initialized = true;
}
final long uptime=ManagementFactory.getRuntimeMXBean().getUptime();
try final long uptime=ManagementFactory.getRuntimeMXBean().getUptime();
{
Class<?> log_class = Loader.loadClass(Log.class, __logClass); try
if (LOG == null || !LOG.getClass().equals(log_class))
{ {
LOG = (Logger)log_class.newInstance(); Class<?> log_class = Loader.loadClass(Log.class, __logClass);
LOG.debug("Logging to {} via {}", LOG, log_class.getName()); if (LOG == null || !LOG.getClass().equals(log_class))
{
LOG = (Logger)log_class.newInstance();
LOG.debug("Logging to {} via {}", LOG, log_class.getName());
}
} }
catch(Throwable e)
{
// Unable to load specified Logger implementation, default to standard logging.
initStandardLogging(e);
}
if (LOG!=null)
LOG.info(String.format("Logging initialized @%dms",uptime));
} }
catch(Throwable e)
{
// Unable to load specified Logger implementation, default to standard logging.
initStandardLogging(e);
}
if (LOG!=null)
LOG.info(String.format("Logging initialized @%dms",uptime));
} }
private static void initStandardLogging(Throwable e) private static void initStandardLogging(Throwable e)