In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "zookeeper how to achieve log output configuration", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "zookeeper how to achieve log output configuration" this article.
Start debug to debug the zookeeper project, and the console management console will output the following warning message.
Log4j:WARN No appenders could be found for logger (org.apache.log4j.jmx.HierarchyDynamicMBean). Log4j:WARN Please initialize the log4j system properly.
In order to output logs for future tracking debugging, you want to use log4j to output logs to the administrative console and log files.
In the source code conf directory, the project comes with a log4j.properties file
Program arguments starts using the zookeeper default configuration file
E:\ zk\ zookeeper-3.3.6\ conf\ zoo_sample.cfg
Eclipse vm arguments specifies to use log4j
-Dzookeeper.log.dir=file:/E:/zk/log
-Dzookeeper.root.logger=DEBUG,CONSOLE,ROLLINGFILE
-Dlog4j.configuration=file:/E:/zk/zookeeper-3.3.6/conf/log4j.properties
The output directory of the scrolling log can be configured through log4j.appender.ROLLINGFILE.File=E:/zk/log/zookeeper.log
Run debugging again, the eclipse management console will no longer print warnings, and the zookeeper.log log file we want can be found in the E:/zk/log directory.
# # ZooKeeper Logging Configuration## Format is "(,) + # DEFAULT: console appender onlylog4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE# Example with rolling log file#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE# Example with rolling log file and tracing#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE TRACEFILE## Log INFO level and above messages to the console#log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppenderlog4j.appender.CONSOLE.Threshold=INFOlog4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayoutlog4j.appender.CONSOLE.layout.ConversionPattern=%d {ISO8601} -%-5p [% ISO8601% C {1} @% L] -% m%n## Add ROLLINGFILE to rootLogger to get log file output# Log DEBUG level and above messages to a log filelog4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppenderlog4j.appender.ROLLINGFILE. Threshold=DEBUGlog4j.appender.ROLLINGFILE.File=E:/zk/log/zookeeper.log# Max log file size of 10MBlog4j.appender.ROLLINGFILE.MaxFileSize=10MB# uncomment the next line to limit number of backup files#log4j.appender.ROLLINGFILE.MaxBackupIndex=10log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayoutlog4j.appender.ROLLINGFILE.layout.ConversionPattern=%d {ISO8601} -%-5p [% ISO8601% C {1} @% L] -% m%n## Add TRACEFILE to rootLogger to get log file output# Log DEBUG level and above messages to A log filelog4j.appender.TRACEFILE=org.apache.log4j.FileAppenderlog4j.appender.TRACEFILE.Threshold=TRACElog4j.appender.TRACEFILE.File=zookeeper_trace.loglog4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout### Notice we are including log4j's NDC here (% x) log4j.appender.TRACEFILE.layout.ConversionPattern=%d {ISO8601} -%-5p [% tGV% C {1} @% L] [% x] -% m% n are all the contents of the article "how zookeeper implements log output configuration" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.