181 } catch (ClassNotFoundException ex) { 182 Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(cname); 183 manager = (LogManager) clz.newInstance(); 184 } 185 } 186 } catch (Exception ex) { 187 System.err.println("Could not load Logmanager \"" + cname + "\""); 188 ex.printStackTrace(); 189 } 190 if (manager == null) { 191 manager = new LogManager(); 192 } 193 194 // Create and retain Logger for the root of the namespace. 195 manager.rootLogger = manager.new RootLogger(); 196 manager.addLogger(manager.rootLogger); 197 manager.systemContext.addLocalLogger(manager.rootLogger); 198 199 // Adding the global Logger. Doing so in the Logger.<clinit> 200 // would deadlock with the LogManager.<clinit>. 201 Logger.global.setLogManager(manager); 202 manager.addLogger(Logger.global); 203 204 // We don't call readConfiguration() here, as we may be running 205 // very early in the JVM startup sequence. Instead readConfiguration 206 // will be called lazily in getLogManager(). 207 return null; 208 } 209 }); 210 } 211 212 213 // This private class is used as a shutdown hook. 214 // It does a "reset" to close all open handlers. 215 private class Cleaner extends Thread { 216 217 private Cleaner() { 218 /* Set context class loader to null in order to avoid 219 * keeping a strong reference to an application classloader. 220 */ | 181 } catch (ClassNotFoundException ex) { 182 Class<?> clz = Thread.currentThread().getContextClassLoader().loadClass(cname); 183 manager = (LogManager) clz.newInstance(); 184 } 185 } 186 } catch (Exception ex) { 187 System.err.println("Could not load Logmanager \"" + cname + "\""); 188 ex.printStackTrace(); 189 } 190 if (manager == null) { 191 manager = new LogManager(); 192 } 193 194 // Create and retain Logger for the root of the namespace. 195 manager.rootLogger = manager.new RootLogger(); 196 manager.addLogger(manager.rootLogger); 197 manager.systemContext.addLocalLogger(manager.rootLogger); 198 199 // Adding the global Logger. Doing so in the Logger.<clinit> 200 // would deadlock with the LogManager.<clinit>. 201 // Do not call Logger.getGlobal() here as this might trigger 202 // the deadlock too. 203 Logger.global.setLogManager(manager); 204 manager.addLogger(Logger.global); 205 206 // We don't call readConfiguration() here, as we may be running 207 // very early in the JVM startup sequence. Instead readConfiguration 208 // will be called lazily in getLogManager(). 209 return null; 210 } 211 }); 212 } 213 214 215 // This private class is used as a shutdown hook. 216 // It does a "reset" to close all open handlers. 217 private class Cleaner extends Thread { 218 219 private Cleaner() { 220 /* Set context class loader to null in order to avoid 221 * keeping a strong reference to an application classloader. 222 */ |