My log4j properties file
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.
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. 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.
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
可能会有所帮助:
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:
Here is an example:
log4j.logger.org.apache=DEBUG, stdout
Question :-- log4j:WARN Please initialize the log4j system properly. ANSWER you should add below line in main method class its working
PropertyConfigurator.configure("src/main/java/com/nsettle/config/log4j.properties");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.