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 * A simple logging facade that is intended simply to capture the style of logging as used by Jetty.
24 public interface Logger
27 * @return the name of this logger
29 public String getName();
32 * Formats and logs at warn level.
33 * @param msg the formatting string
34 * @param args the optional arguments
36 public void warn(String msg, Object... args);
39 * Logs the given Throwable information at warn level
40 * @param thrown the Throwable to log
42 public void warn(Throwable thrown);
45 * Logs the given message at warn level, with Throwable information.
46 * @param msg the message to log
47 * @param thrown the Throwable to log
49 public void warn(String msg, Throwable thrown);
52 * Formats and logs at info level.
53 * @param msg the formatting string
54 * @param args the optional arguments
56 public void info(String msg, Object... args);
59 * Logs the given Throwable information at info level
60 * @param thrown the Throwable to log
62 public void info(Throwable thrown);
65 * Logs the given message at info level, with Throwable information.
66 * @param msg the message to log
67 * @param thrown the Throwable to log
69 public void info(String msg, Throwable thrown);
72 * @return whether the debug level is enabled
74 public boolean isDebugEnabled();
77 * Mutator used to turn debug on programmatically.
78 * @param enabled whether to enable the debug level
80 public void setDebugEnabled(boolean enabled);
83 * Formats and logs at debug level.
84 * @param msg the formatting string
85 * @param args the optional arguments
87 public void debug(String msg, Object... args);
91 * Formats and logs at debug level.
92 * avoids autoboxing of integers
93 * @param msg the formatting string
94 * @param value long value
96 public void debug(String msg, long value);
99 * Logs the given Throwable information at debug level
100 * @param thrown the Throwable to log
102 public void debug(Throwable thrown);
105 * Logs the given message at debug level, with Throwable information.
106 * @param msg the message to log
107 * @param thrown the Throwable to log
109 public void debug(String msg, Throwable thrown);
112 * @param name the name of the logger
113 * @return a logger with the given name
115 public Logger getLogger(String name);
118 * Ignore an exception.
119 * <p>This should be used rather than an empty catch block.
121 public void ignore(Throwable ignored);