Logger.GetLogger Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetLogger(String) |
Find or create a logger for a named subsystem. |
GetLogger(String, String) |
Find or create a logger for a named subsystem. |
GetLogger(String)
Find or create a logger for a named subsystem.
[Android.Runtime.Register("getLogger", "(Ljava/lang/String;)Ljava/util/logging/Logger;", "")]
public static Java.Util.Logging.Logger GetLogger (string name);
[<Android.Runtime.Register("getLogger", "(Ljava/lang/String;)Ljava/util/logging/Logger;", "")>]
static member GetLogger : string -> Java.Util.Logging.Logger
Parameters
- name
- String
A name for the logger. This should be a dot-separated name and should normally be based on the package name or class name of the subsystem, such as java.net or javax.swing
Returns
a suitable Logger
- Attributes
Exceptions
If the specified resource bundle can not be loaded.
Remarks
Find or create a logger for a named subsystem. If a logger has already been created with the given name it is returned. Otherwise a new logger is created.
If a new logger is created its log level will be configured based on the LogManager configuration and it will configured to also send logging output to its parent's Handlers. It will be registered in the LogManager global namespace.
Note: The LogManager may only retain a weak reference to the newly created Logger. It is important to understand that a previously created Logger with the given name may be garbage collected at any time if there is no strong reference to the Logger. In particular, this means that two back-to-back calls like getLogger("MyLogger").log(...)
may use different Logger objects named "MyLogger" if there is no strong reference to the Logger named "MyLogger" elsewhere in the program.
Java documentation for java.util.logging.Logger.getLogger(java.lang.String)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
GetLogger(String, String)
Find or create a logger for a named subsystem.
[Android.Runtime.Register("getLogger", "(Ljava/lang/String;Ljava/lang/String;)Ljava/util/logging/Logger;", "")]
public static Java.Util.Logging.Logger GetLogger (string name, string? resourceBundleName);
[<Android.Runtime.Register("getLogger", "(Ljava/lang/String;Ljava/lang/String;)Ljava/util/logging/Logger;", "")>]
static member GetLogger : string * string -> Java.Util.Logging.Logger
Parameters
- name
- String
A name for the logger. This should be a dot-separated name and should normally be based on the package name or class name of the subsystem, such as java.net or javax.swing
- resourceBundleName
- String
name of ResourceBundle to be used for localizing
messages for this logger. May be null
if none of the messages require localization.
Returns
a suitable Logger
- Attributes
Exceptions
if the logger identified by name
is associated with a
resource bundle and its name is not equal to
resourceBundleName
.
if the name of the resource bundle cannot be found.
Remarks
Find or create a logger for a named subsystem. If a logger has already been created with the given name it is returned. Otherwise a new logger is created.
If a new logger is created its log level will be configured based on the LogManager and it will configured to also send logging output to its parent's Handlers. It will be registered in the LogManager global namespace.
Note: The LogManager may only retain a weak reference to the newly created Logger. It is important to understand that a previously created Logger with the given name may be garbage collected at any time if there is no strong reference to the Logger. In particular, this means that two back-to-back calls like getLogger("MyLogger", ...).log(...)
may use different Logger objects named "MyLogger" if there is no strong reference to the Logger named "MyLogger" elsewhere in the program.
If the named Logger already exists and does not yet have a localization resource bundle then the given resource bundle name is used. If the named Logger already exists and has a different resource bundle name then an IllegalArgumentException is thrown.
Java documentation for java.util.logging.Logger.getLogger(java.lang.String, java.lang.String)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.