215 private volatile Logger parent; // our nearest parent. 216 private ArrayList<LogManager.LoggerWeakRef> kids; // WeakReferences to loggers that have us as parent 217 private volatile Level levelObject; 218 private volatile int levelValue; // current effective level value 219 private WeakReference<ClassLoader> callersClassLoaderRef; 220 221 /** 222 * GLOBAL_LOGGER_NAME is a name for the global logger. 223 * 224 * @since 1.6 225 */ 226 public static final String GLOBAL_LOGGER_NAME = "global"; 227 228 /** 229 * Return global logger object with the name Logger.GLOBAL_LOGGER_NAME. 230 * 231 * @return global logger object 232 * @since 1.7 233 */ 234 public static final Logger getGlobal() { 235 return global; 236 } 237 238 /** 239 * The "global" Logger object is provided as a convenience to developers 240 * who are making casual use of the Logging package. Developers 241 * who are making serious use of the logging package (for example 242 * in products) should create and use their own Logger objects, 243 * with appropriate names, so that logging can be controlled on a 244 * suitable per-Logger granularity. Developers also need to keep a 245 * strong reference to their Logger objects to prevent them from 246 * being garbage collected. 247 * <p> 248 * @deprecated Initialization of this field is prone to deadlocks. 249 * The field must be initialized by the Logger class initialization 250 * which may cause deadlocks with the LogManager class initialization. 251 * In such cases two class initialization wait for each other to complete. 252 * The preferred way to get the global logger object is via the call 253 * <code>Logger.getGlobal()</code>. 254 * For compatibility with old JDK versions where the | 215 private volatile Logger parent; // our nearest parent. 216 private ArrayList<LogManager.LoggerWeakRef> kids; // WeakReferences to loggers that have us as parent 217 private volatile Level levelObject; 218 private volatile int levelValue; // current effective level value 219 private WeakReference<ClassLoader> callersClassLoaderRef; 220 221 /** 222 * GLOBAL_LOGGER_NAME is a name for the global logger. 223 * 224 * @since 1.6 225 */ 226 public static final String GLOBAL_LOGGER_NAME = "global"; 227 228 /** 229 * Return global logger object with the name Logger.GLOBAL_LOGGER_NAME. 230 * 231 * @return global logger object 232 * @since 1.7 233 */ 234 public static final Logger getGlobal() { 235 // In order to break a cyclic dependence between the LogManager 236 // and Logger static initializers causing deadlocks, the global 237 // logger is created with a special constructor that does not 238 // initialize its log manager. 239 // 240 // If an application calls Logger.getGlobal() before any logger 241 // has been initialized, it is therefore possible that the 242 // LogManager class has not been initialized yet, and therefore 243 // Logger.global.manager will be null. 244 // 245 // In order to finish the initialization of the global logger, we 246 // will therefore call LogManager.getLogManager() here. 247 // 248 // Care must be taken *not* to call Logger.getGlobal() in 249 // LogManager static initializers in order to avoid such 250 // deadlocks. 251 // 252 if (global != null && global.manager == null) { 253 // Complete initialization of the global Logger. 254 global.manager = LogManager.getLogManager(); 255 } 256 return global; 257 } 258 259 /** 260 * The "global" Logger object is provided as a convenience to developers 261 * who are making casual use of the Logging package. Developers 262 * who are making serious use of the logging package (for example 263 * in products) should create and use their own Logger objects, 264 * with appropriate names, so that logging can be controlled on a 265 * suitable per-Logger granularity. Developers also need to keep a 266 * strong reference to their Logger objects to prevent them from 267 * being garbage collected. 268 * <p> 269 * @deprecated Initialization of this field is prone to deadlocks. 270 * The field must be initialized by the Logger class initialization 271 * which may cause deadlocks with the LogManager class initialization. 272 * In such cases two class initialization wait for each other to complete. 273 * The preferred way to get the global logger object is via the call 274 * <code>Logger.getGlobal()</code>. 275 * For compatibility with old JDK versions where the |