Java.Util.Logging.Logger Class
Loggers are used to log records to a variety of destinations such as log files or the console.

See Also: Logger Members

Syntax

[Android.Runtime.Register("java/util/logging/Logger", DoNotGenerateAcw=true)]
public class Logger : Java.Lang.Object

Remarks

Loggers are used to log records to a variety of destinations such as log files or the console. They use instances of Java.Util.Logging.Handler to actually do the destination-specific operations.

Client applications can get named loggers by calling the getLogger methods. They can also get anonymous loggers by calling the getAnonymousLogger methods. Named loggers are organized in a namespace hierarchy managed by a log manager. The naming convention is usually the Java package naming convention. Anonymous loggers do not belong to any namespace.

Developers should use named loggers to enable logging to be controlled on a per-Logger granularity. The recommended idiom is to create and assign the logger to a static final field. This ensures that there's always a strong reference to the logger, preventing it from being garbage collected. In particular, LogManager.AddLogger(Logger) will not keep your logger live.

Loggers "inherit" log level setting from their parent if their own level is set to null. This is also true for the resource bundle. The logger's resource bundle is used to localize the log messages if no resource bundle name is given when a log method is called. If getUseParentHandlers() returns true, loggers also inherit their parent's handlers. In this context, "inherit" only means that "behavior" is inherited. The internal field values will not change, for example, getLevel() still returns null.

When loading a given resource bundle, the logger first tries to use the context ClassLoader. If that fails, it tries the system ClassLoader. And if that still fails, it searches up the class stack and uses each class's ClassLoader to try to locate the resource bundle.

Some log methods accept log requests that do not specify the source class and source method. In these cases, the logging framework will automatically infer the calling class and method, but this is not guaranteed to be accurate.

Once a LogRecord object has been passed into the logging framework, it is owned by the logging framework and the client applications should not use it any longer.

All methods of this class are thread-safe.

See Also

[Android Documentation]

Requirements

Namespace: Java.Util.Logging
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1