java 警告找不到记录器的附加程序(org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14235633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WARN No appenders could be found for logger (org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager)
提问by Ram
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 msgas 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
请帮忙解决这个问题
采纳答案by Simulant
As I remember the log4j.properties
file must be in the root-directory
of the execution and added to the classPath. So this means the file must be on the same level as the src-Folder
and not within this folder. Or you have to change the root-directory of your execution to your src-folder.
我记得该log4j.properties
文件必须在root-directory
执行中并添加到 classPath 中。因此,这意味着该文件必须src-Folder
与该文件夹位于同一级别,并且不在此文件夹内。或者您必须将执行的根目录更改为您的 src 文件夹。
回答by Jintian DENG
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.
您应该定义一个根记录器以避免此类“无附加程序”警告。
log4j.rootLogger=DEBUG, dest1
回答by Yana
May be it will help:
可能会有所帮助:
org.apache.log4j.PropertyConfigurator.configure(log4j.propertiesLocation);
回答by Eli
You could add the add part of your package URL and all sub-packages will be printed to the log:
您可以添加包 URL 的 add 部分,所有子包都将打印到日志中:
Here is an example:
下面是一个例子:
log4j.logger.org.apache=DEBUG, stdout
log4j.logger.org.apache=调试,标准输出
回答by pshailu
Question :-- log4j:WARN Please initialize the log4j system properly. ANSWER you should add below line in main method class its working
问题 :-- log4j:WARN 请正确初始化 log4j 系统。ANSWER 你应该在 main 方法类中添加下面的行它的工作
PropertyConfigurator.configure("src/main/java/com/nsettle/config/log4j.properties");
PropertyConfigurator.configure("src/main/java/com/nsettle/config/log4j.properties");