public class LunaLogging
extends java.util.logging.Formatter
Constructor and Description |
---|
LunaLogging() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
format(java.util.logging.LogRecord record)
Format the raw record data input according to a prescribed MessageFormat above.
|
static java.lang.String |
getCallingClassName(int aInLevel)
Gets the name of the class calling the caller of this method.
|
static java.lang.String |
getCallingClassName(java.lang.Throwable aInThrowable,
int aInLevel)
Gets the name of the class that created the throwable.
|
static java.util.logging.Logger |
getLogger()
Gets a logger whose category is the full name of the calling class.
|
static java.util.logging.Logger |
getLogger(java.lang.String aInClassName)
Either set the created logger with a new temporary handler and subsequent formatter or override
the root logger of the JVM
overridesystemlogging - This means that the Luna logging code will explicitly manage the
logging handlers and formatters as opposed to the default mechanism.
|
static void |
overrideRootLogger()
override the root logger's (the JVM's JUL logger) handlers' log message formatters
Don't do this if LunaProvider is being used within a more complex application environment like
JBoss or another application server where they are employing more elaborate logging mechanisms.
|
public java.lang.String format(java.util.logging.LogRecord record)
format
in class java.util.logging.Formatter
record
- the record record to be formattedpublic static void overrideRootLogger()
public static java.util.logging.Logger getLogger(java.lang.String aInClassName)
aInClassName
- the calling class namepublic static java.lang.String getCallingClassName(java.lang.Throwable aInThrowable, int aInLevel)
E.g. for a stack trace as follows: A.a() B.b() C.c() LunaLogging.getCallingClassName(new Throwable(), n) For n = 0 "C" is returned; for n = 1 "B" is returned.Note that this is a fairly expensive operation!!!
aInThrowable
- the exception to processaInLevel
- the number of levels above the caller to extractpublic static java.lang.String getCallingClassName(int aInLevel)
E.g. for a stack trace as follows: A.a() B.b() C.c() LunaLogging.getCallingClassName(n) For n = 0 "B" is returned; for n = 1 "A" is returned.Note that this is a fairly expensive operation!!!
aInLevel
- the number of levels above the caller to extractpublic static java.util.logging.Logger getLogger()
Intended for use as: private static final Logger logger = LunaLogging.getLogger();It is an expensive operation to determine the calling class, so avoid creating transient loggers with this.
Copyright 2014-2018 SafeNet. All rights reserved.