[英]WARN No appenders could be found for logger (org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager)
My log4j properties file 我的log4j属性文件
log4j.logger.devpinoyLogger=DEBUG, dest1,
log4j.appender.dest1=org.apache.log4j.RollingFileAppender
log4j.appender.dest1.maxFileSize=5000KB
log4j.appender.dest1.maxBackupIndex=3
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss} %c %m%n
log4j.appender.dest1.File=C:\\Selenium\\eclipse-jee-juno-SR1-win32\\eclipse\\Workspace\\Core_Hybrid\\src\\com\\logs\\Application.log
log4j.appender.dest1.Append=false
I get the Error msg as stated below : 我得到错误消息 ,如下所述:
log4j:WARN No appenders could be found for logger (org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager).
log4j:WARN Please initialize the log4j system properly.
I have placed my properties files inside the src folder and imported the log4j.jar in the build path. 我已将属性文件放在src文件夹中,并在构建路径中导入log4j.jar。
Please help on this 请帮忙
As I remember the log4j.properties
file must be in the root-directory
of the execution and added to the classPath. 我记得log4j.properties
文件必须位于执行的root-directory
中并添加到classPath中。 So this means the file must be on the same level as the src-Folder
and not within this folder. 所以这意味着文件必须与src-Folder
处于同一级别,而不是在此文件夹中。 Or you have to change the root-directory of your execution to your src-folder. 或者您必须将执行的根目录更改为src文件夹。
There's a typo in your configuration file. 您的配置文件中存在拼写错误。 Remove the last ',' in the first line: 删除第一行中的最后一个',':
log4j.logger.devpinoyLogger=DEBUG, dest1
You should define a root logger to avoid such "No appender" warning. 您应该定义一个根记录器以避免这种“无appender”警告。
log4j.rootLogger=DEBUG, dest1
可能会有所帮助:
org.apache.log4j.PropertyConfigurator.configure(log4j.propertiesLocation);
You could add the add part of your package URL and all sub-packages will be printed to the log: 您可以添加包URL的添加部分,所有子包将打印到日志中:
Here is an example: 这是一个例子:
log4j.logger.org.apache=DEBUG, stdout log4j.logger.org.apache = DEBUG,stdout
Question :-- log4j:WARN Please initialize the log4j system properly. 问题: - log4j:WARN请正确初始化log4j系统。 ANSWER you should add below line in main method class its working 答案你应该在main方法类的下面添加它的工作
PropertyConfigurator.configure("src/main/java/com/nsettle/config/log4j.properties"); PropertyConfigurator.configure( “SRC /主/ JAVA / COM / nsettle /配置/ log4j.properties”);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.