public final class LoggingHelper
extends java.lang.Object
Credits: com.twitter.heron.common.utils.logging.LoggingHelper
Modifier and Type | Class and Description |
---|---|
static class |
LoggingHelper.LoggingOutputStream
An OutputStream that writes contents to a Logger upon each call to flush()
|
static class |
LoggingHelper.StdOutErrLevel |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_FORMAT |
Modifier and Type | Method and Description |
---|---|
static void |
addLoggingHandler(java.util.logging.Handler handler) |
static java.util.logging.FileHandler |
getFileHandler(java.lang.String workerId,
java.lang.String loggingDir,
Config config)
Deprecated.
Use
Twister2FileLogHandler instead |
static void |
initTwisterFileLogHandler(java.lang.String logFile,
java.lang.String logDir,
Config config) |
static void |
loggerInit(boolean isRedirectStdOutErr)
Init java util logging with default format
|
static void |
loggerInit(boolean isRedirectStdOutErr,
java.lang.String format)
Init java util logging
|
static void |
setLoggingFormat(java.lang.String format) |
static void |
setLogLevel(java.util.logging.Level level) |
static void |
setupLogging(Config config,
java.lang.String logDir,
java.lang.String logFile)
this method is called to setup logging parameters
and file handler
|
public static final java.lang.String DEFAULT_FORMAT
public static void loggerInit(boolean isRedirectStdOutErr) throws java.io.IOException
isRedirectStdOutErr
- whether we redirect std out&errjava.io.IOException
public static void loggerInit(boolean isRedirectStdOutErr, java.lang.String format) throws java.io.IOException
isRedirectStdOutErr
- whether we redirect std out&errformat
- the format to logjava.io.IOException
public static void setLoggingFormat(java.lang.String format)
public static void addLoggingHandler(java.util.logging.Handler handler)
public static void setLogLevel(java.util.logging.Level level)
public static void initTwisterFileLogHandler(java.lang.String logFile, java.lang.String logDir, Config config) throws java.io.IOException
java.io.IOException
@Deprecated public static java.util.logging.FileHandler getFileHandler(java.lang.String workerId, java.lang.String loggingDir, Config config) throws java.io.IOException, java.lang.SecurityException
Twister2FileLogHandler
insteadThe FileHandler is configured based on LogManager properties (or their default values) except that the given pattern argument is used as the filename pattern, the file limit is set to the limit argument, and the file count is set to the given count argument, and the append mode is set to the given append argument.
The count must be at least 1.
java.io.IOException
- if there are IO problems opening the files.java.lang.SecurityException
- if a security manager exists and if
the caller does not have LoggingPermission("control").java.lang.IllegalArgumentException
- if limit < 0
, or count < 1
.java.lang.IllegalArgumentException
- if pattern is an empty stringpublic static void setupLogging(Config config, java.lang.String logDir, java.lang.String logFile)