[quote:3dph6xdk]log4j:WARN No appenders could be found for logger (devpinoyLogger).
log4j:WARN Please initialize the log4j system properly.
[/quote:3dph6xdk]
this is just warning and can be ignored.
try this q/a follow the steps.
http://stackoverflow.com/questions/3495443/how-to-implement-use-log4j
Hi..Has this issue got resolved. I am also facing the same eroor. Log4.propert file I have used is :-
#Application Logs
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=D:\\TestData\\Logs\\Application.log
#do not append the old file. Create a new log file everytime
log4j.appender.dest1.Append=false
Kindly help.
Yes, I have created the folder before running log4J. I want my test logs to be created under the folder Logs.
follow the steps here
http://stackoverflow.com/questions/3495443/how-to-implement-use-log4j
if this doesn't work, tell me.
I have done few changes:-
[b:4wrdgkbn]1.Added BasicConfigurator.configure(); in my Test_Log4j Class
Logger APPLICATION_LOGS = Logger.getLogger("devpinoyLogger");
APPLICATION_LOGS.debug("hello");
APPLICATION_LOGS.debug("We are wrinting in to a log file");
APPLICATION_LOGS.debug("starting the test case xyz test");
2.Added below in Log4j Properties:-[/b:4wrdgkbn]
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
#log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
Now, the debug logs are getting printed in the cosole. The waring is not coming, but I want to create log files in my folder which is not getting generated.
Please suggest.
use these and tell me if its working.
[quote:34yrxrir]#Application Logs
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:\\testing\\Application.log
#do not append the old file. Create a new log file everytime
log4j.appender.dest1.Append=false
[/quote:34yrxrir]
[code:34yrxrir]package com.soapuitutorial.propertie;
import org.apache.log4j.Logger;
public class Logging_Example {
/**
* @param args
*/
public static void main(String[] args) {
// add log4j.jar
// add log4j.propertie directly inside the src folder
// create the object in the code
Logger APPLICATION_LOGS = Logger.getLogger("devpinoyLogger");
APPLICATION_LOGS.debug("hello");
APPLICATION_LOGS.debug("We are wrinting in to a log file");
APPLICATION_LOGS.debug("starting the test case xyz test");
}
}
[/code:34yrxrir]