public class LogBase extends Object
The base class for logging.
The default log base directory is ${user.home}/logs/csp/. We can use the LOG_DIR
property to override it. The default log file name dose not contain pid, but if multi-instances of the same service
are running in the same machine, we may want to distinguish the log file by process ID number.
In this case, LOG_NAME_USE_PID property could be configured as "true" to turn on this switch.
| Modifier and Type | Field and Description |
|---|---|
static String |
LOG_CHARSET |
static String |
LOG_CHARSET_UTF8 |
static String |
LOG_DIR |
static String |
LOG_NAME_USE_PID |
static String |
LOG_OUTPUT_TYPE |
static String |
LOG_OUTPUT_TYPE_CONSOLE
Output biz log (e.g.
|
static String |
LOG_OUTPUT_TYPE_FILE
Output biz log (e.g.
|
| Constructor and Description |
|---|
LogBase() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getLogBaseDir()
Get the log file base directory path, which is guaranteed ended with
File.separator. |
static String |
getLogCharset()
Get the log file charset.
|
static String |
getLogOutputType()
Get the log file output type.
|
static boolean |
isLogNameUsePid()
Whether log file name should contain pid.
|
protected static void |
log(Logger logger,
Handler handler,
Level level,
String detail,
Object... params) |
protected static void |
log(Logger logger,
Handler handler,
Level level,
String detail,
Throwable throwable) |
protected static Handler |
makeLogger(String logName,
Logger heliumRecordLog) |
public static final String LOG_DIR
public static final String LOG_NAME_USE_PID
public static final String LOG_OUTPUT_TYPE
public static final String LOG_CHARSET
public static final String LOG_OUTPUT_TYPE_FILE
public static final String LOG_OUTPUT_TYPE_CONSOLE
public static final String LOG_CHARSET_UTF8
public static boolean isLogNameUsePid()
LOG_NAME_USE_PID system property.public static String getLogBaseDir()
File.separator.public static String getLogOutputType()
public static String getLogCharset()
protected static void log(Logger logger, Handler handler, Level level, String detail, Object... params)
protected static void log(Logger logger, Handler handler, Level level, String detail, Throwable throwable)
Copyright © 2019 Alibaba Group. All rights reserved.