官方配置文檔:
https://logging.apache.org/log4j/2.x/manual/filters.html
根節(jié)點<Configuration>
文章來源:http://www.zghlxwxcb.cn/news/detail-405823.html
<!--設(shè)置log4j2自身內(nèi)部的信息輸出級別為info-->
<!--Log4j每隔10秒自動檢測修改配置文件和重新配置本身,不需要重啟服務(wù)-->
<Configuration status="info" monitorInterval="10">
</Configuration>
參數(shù)介紹: 文章來源地址http://www.zghlxwxcb.cn/news/detail-405823.html
Attribute Name | Description |
---|---|
name |
The name of the configuration. |
monitorInterval |
Log4j has the ability to automatically detect changes to the configuration file and reconfigure itself。 即動態(tài)加載,單位是秒??勺远x配置,最小間隔為5秒 |
status |
記錄log4j本身的日志級別 The level of internal Log4j events that should be logged to the console. Valid values for this attribute are “off”, “trace”, “debug”, “info”, “warn”, “error”, “fatal”, and “all”. 如果需要對log4j進(jìn)行故障排除,可設(shè)置status=“trace” 設(shè)置系統(tǒng)屬性Log4j2.debug也會將內(nèi)部Log4j2日志記錄打印到控制臺 |
advertiser | (Optional) The Advertiser plugin name which will be used to advertise individual FileAppender or SocketAppender configurations. The only Advertiser plugin provided is 'multicastdns". |
dest | Either “err” for stderr, “out” for stdout, a file path, or a URL. |
packages | Use of the packages attribute is deprecated and will be removed in Log4j 3.0. Plugins should be processed with the Log4j annotation processor. A comma separated list of package names to search for plugins. Plugins are only loaded once per classloader so changing this value may not have any effect upon reconfiguration. |
schema | Identifies the location for the classloader to located the XML Schema to use to validate the configuration. Only valid when strict is set to true. If not set no schema validation will take place. |
shutdownHook | Specifies whether or not Log4j should automatically shutdown when the JVM shuts down. The shutdown hook is enabled by default but may be disabled by setting this attribute to “disable” |
shutdownTimeout | Specifies how many milliseconds appenders and background tasks will get to shutdown when the JVM shuts down. Default is zero which mean that each appender uses its default timeout, and don’t wait for background tasks. Not all appenders will honor this, it is a hint and not an absolute guarantee that the shutdown procedure will not take longer. Setting this too low increase the risk of losing outstanding log events not yet written to the final destination. See LoggerContext.stop(long, java.util.concurrent.TimeUnit). (Not used if shutdownHook is set to “disable”.) |
strict | Enables the use of the strict XML format. Not supported in JSON configurations. |
verbose | Enables diagnostic information while loading plugins. |
到了這里,關(guān)于Log4j2的Configuration詳解的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!