| java.lang.Object org.geotools.util.Logging
Logging | final public class Logging (Code) | | A set of utilities method for configuring loggings in Geotools. Those methods operates on the
, which is the framework used by Geotools.
since: 2.4 version: $Id: Logging.java 27874 2007-11-13 14:23:34Z aaime $ author: Martin Desruisseauxorg.geotools.util.logging |
Field Summary | |
final public static Logging | ALL Logging configuration that applied to all packages. | final public static Logging | GEOTOOLS Logging configuration that applies only to Geotools packages. |
Constructor Summary | |
public | Logging(String root) Creates an instance for the specified root package. |
Method Summary | |
public void | forceMonolineConsoleOutput() Configures the default
in order to log records
on a single line instead of two lines. | public synchronized void | forceMonolineConsoleOutput(Level level) Same as
Logging.forceMonolineConsoleOutput() , but additionnaly set an optional logging
level. | public static boolean | isCommonsLoggingAvailable() Returns
true if the
commons-logging
framework seems to be available on the classpath. | public synchronized boolean | redirectToCommonsLogging() Redirects
events to the Apache's
commons-logging framework.
This method should be invoked again when the common-logging configuration change. | public static boolean | unexpectedException(Logger logger, Throwable error) Invoked when an unexpected error occurs. | public static void | unexpectedException(Logger logger, Class classe, String method, Throwable error) Invoked when an unexpected error occurs. | public static void | unexpectedException(String paquet, Class classe, String method, Throwable error) Invoked when an unexpected error occurs. | public static void | unexpectedException(String paquet, String classe, String method, Throwable error) Same as
Logging.unexpectedException(String,Class,String,Throwable)unexpectedException(..., Class, ...) except that the class name is
specified as a string.
Parameters: paquet - The package where the error occurred, or null . |
ALL | final public static Logging ALL(Code) | | Logging configuration that applied to all packages.
|
GEOTOOLS | final public static Logging GEOTOOLS(Code) | | Logging configuration that applies only to Geotools packages.
|
Logging | public Logging(String root)(Code) | | Creates an instance for the specified root package.
|
isCommonsLoggingAvailable | public static boolean isCommonsLoggingAvailable()(Code) | | Returns
true if the
commons-logging
framework seems to be available on the classpath.
|
redirectToCommonsLogging | public synchronized boolean redirectToCommonsLogging()(Code) | | Redirects
events to the Apache's
commons-logging framework.
This method should be invoked again when the common-logging configuration change. For
example if the Log4J configuration is dynamically changed at runtime, then
this method should be invoked again.
If this method determines that commons-logging would redirect all log events
to the java logging system, then this method do nothing and return
false .
true if the adapter has been installed or re-installed, or false if this method did nothing. See Also: org.geotools.factory.GeoTools.initorg.geotools.util.logging.Logging.setLoggerFactory |
unexpectedException | public static boolean unexpectedException(Logger logger, Throwable error)(Code) | | Invoked when an unexpected error occurs. This method logs a message at the
Level.WARNING WARNING level to the specified logger. The originating
class name and method name are inferred from the error stack trace, using the
first
for which the class
name is inside a package or sub-package of the logger name. For example if
the logger name is
"org.geotools.image" , then this method will uses
the first stack trace element where the fully qualified class name starts with
"org.geotools.image" or
"org.geotools.image.io" , but not
"org.geotools.imageio" .
Parameters: logger - Where to log the error. Parameters: error - The error that occured. true if the error has been logged, or false if the loggerdoesn't log anything at the Level.WARNING WARNING level. |
unexpectedException | public static void unexpectedException(Logger logger, Class classe, String method, Throwable error)(Code) | | Invoked when an unexpected error occurs. This method logs a message at the
Level.WARNING WARNING level to the specified logger. The originating
class name and method name can optionnaly be specified. If any of them is
null , then it will be inferred from the error stack trace as in
Logging.unexpectedException(Logger,Throwable) .
Explicit value for class and method names are sometime preferred to automatic
inference for the following reasons:
Automatic inference is not 100% reliable, since the Java Virtual Machine
is free to omit stack frame in optimized code.
When an exception occured in a private method used internally by a public
method, we sometime want to log the warning for the public method instead,
since the user is not expected to know anything about the existence of the
private method. If a developper really want to know about the private method,
the stack trace is still available anyway.
Parameters: logger - Where to log the error. Parameters: classe - The class where the error occurred, or null . Parameters: method - The method where the error occurred, or null . Parameters: error - The error. |
unexpectedException | public static void unexpectedException(String paquet, Class classe, String method, Throwable error)(Code) | | Invoked when an unexpected error occurs. This method logs a message at the
Level.WARNING WARNING level to the logger for the specified package
name. The originating class name and method name can optionnaly be specified.
If any of them is
null , then it will be inferred from the error stack
trace as in
Logging.unexpectedException(Logger,Throwable) .
Parameters: paquet - The package where the error occurred, or null . Thisinformation is used for fetching an appropriate Loggerfor logging the error. Parameters: classe - The class where the error occurred, or null . Parameters: method - The method where the error occurred, or null . Parameters: error - The error. |
unexpectedException | public static void unexpectedException(String paquet, String classe, String method, Throwable error)(Code) | | Same as
Logging.unexpectedException(String,Class,String,Throwable)unexpectedException(..., Class, ...) except that the class name is
specified as a string.
Parameters: paquet - The package where the error occurred, or null . Thisinformation is used for fetching an appropriate Loggerfor logging the error. Parameters: classe - The class where the error occurred, or null . Parameters: method - The method where the error occurred, or null . Parameters: error - The error.Logging.unexpectedException(String,Class,String,Throwable) |
|
|