對這文章發表回應
發表限制: 非會員 可以發表
Logging properties file
The Dgraph HDFS Agent has a default Log4j configuration file that sets its logging properties.
The file is named log4j.properties and is located in the $DGRAPH_HOME/dgraph-hdfs-agent/lib directory.
log4j.rootLogger=INFO, ROLLINGFILE
#
# Add ROLLINGFILE to rootLogger to get log file output
# Log DEBUG level and above messages to a log file
log4j.appender.ROLLINGFILE=oracle.core.ojdl.log4j.OracleAppender
log4j.appender.ROLLINGFILE.ComponentId=DgraphHDFSAgent
log4j.appender.ROLLINGFILE.Path=${logfilename}
log4j.appender.ROLLINGFILE.Format=ODL-Text
log4j.appender.ROLLINGFILE.MaxSegmentSize=10485760
log4j.appender.ROLLINGFILE.MaxSize=1048576000
log4j.appender.ROLLINGFILE.Encoding=UTF-8
log4j.appender.ROLLINGFILE.layout = org.apache.log4j.PatternLayout
log4j.appender.ROLLINGFILE.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
The file defines the ROLLINGFILE appenders for the root logger and also sets the log level for the file.
Logging property | Description |
---|---|
log4j.rootLogger | The level of the root logger is defined as INFO and attaches the ROLLINGFILE appender to it. You can change the log level, but do not change the ROLLINGFILE appender. |
log4j.appender.ROLLINGFILE | Sets the appender to be OracleAppender. This defines the ODL (Oracle Diagnostics Logging) format for the log entries. Do not change this property. |
log4j.appender.ROLLINGFILE.ComponentId | Sets DgraphHDFSAgent as the name of the component that generates the log messages. Do not change this property. |
log4j.appender.ROLLINGFILE.Path | Sets the path for the log files. The ${logfilename} variable picks up the path from the Dgraph HDFS Agent --out flag used at start-up time. Do not change this property. |
log4j.appender.ROLLINGFILE.Format | Sets ODL-Text as the formatted string as specified by the conversion pattern. Do not change this property. |
log4j.appender.ROLLINGFILE.MaxSegmentSize | Sets the maximum size (in bytes) of the log file. When the dgraphHDFSAgent.out file reaches this size, a rollover file is created. The default is 10485760 (about 10 MB). |
log4j.appender.ROLLINGFILE.MaxSize | Sets the maximum amount of disk space to be used by the dgraphHDFSAgent.out file and the logging rollover files. The default is 1048576000 (about 1GB). |
log4j.appender.ROLLINGFILE.Encoding | Sets character encoding for the log file. The default UTF-8 value prints out UTF-8 characters in the file. |
log4j.appender.ROLLINGFILE.layout | Sets the org.apache.log4j.PatternLayout class for the layout. |
log4j.appender.ROLLINGFILE.layout.ConversionPattern | Defines the log entry conversion pattern. For the conversion characters, see: https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html |
Logging levels
log4j.rootLogger=ERROR
Java Log Level | ODL Log Level | Meaning |
---|---|---|
OFF | N/A | Has the highest possible rank and is used to turn off logging. |
FATAL | INCIDENT_ERROR | Indicates a serious problem that may be caused by a bug in the product and that should be reported to Oracle Support. In general, these messages describe events that are of considerable importance and which will prevent normal program execution. |
ERROR | ERROR | Indicates a serious problem that requires immediate attention from the administrator and is not caused by a bug in the product. |
WARN | WARNING | Indicates a potential problem that should be reviewed by the administrator. |
INFO | NOTIFICATION | A message level for informational messages. This level typically indicates a major lifecycle event such as the activation or deactivation of a primary sub-component or feature. This is the default level. |
DEBUG | TRACE | Debug information for events that are meaningful to administrators, such as public API entry or exit points. |
These levels allow you to monitor events of interest at the appropriate granularity without being overwhelmed by messages that are not relevant. When you are initially setting up your application in a development environment, you might want to use the INFO level to get most of the messages, and change to a less verbose level in production.
原文出處:OracleDoc:Logging properties file