2 // ========================================================================
3 // Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
19 package org.eclipse.jetty.util.log;
22 /* ------------------------------------------------------------ */
24 * Manages the atomic registration of the logger by name.
26 public abstract class AbstractLogger implements Logger
29 public final Logger getLogger(String name)
34 final String basename = getName();
35 final String fullname = (isBlank(basename) || Log.getRootLogger()==this)?name:(basename + "." + name);
37 Logger logger = Log.getLoggers().get(fullname);
40 Logger newlog = newLogger(fullname);
42 logger = Log.getMutableLoggers().putIfAbsent(fullname,newlog);
51 protected abstract Logger newLogger(String fullname);
54 * A more robust form of name blank test. Will return true for null names, and names that have only whitespace
58 * @return true for null or blank name, false if any non-whitespace character is found.
60 private static boolean isBlank(String name)
66 int size = name.length();
68 for (int i = 0; i < size; i++)
71 if (!Character.isWhitespace(c))
79 public void debug(String msg, long arg)
83 debug(msg,new Object[] { new Long(arg) });