try this log4j.properties and java file
[quote:egqtqryd]#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:egqtqryd]
[quote:egqtqryd]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");
}
}
[/quote:egqtqryd]
getting same error as mentioned in original post:
log4j:WARN No appenders could be found for logger (devpinoyLogger).
log4j:WARN Please initialize the log4j system properly.
how to fix this error? -- i have same log4j.properties as you posted in response. Still now working.
I'm getting the same error. I'm using a mac and below is my log4j file:
How to set up correct file path?
#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=Users/tu//Documents//tmp//Test.log
#do not append the old file. Create a new log file everytime
log4j.appender.dest1.Append=false
try this
[quote:10iiexg9]log4j.appender.dest1.File=/Users/tu/Documents/tmp/Test.log
[/quote:10iiexg9]
I tried your suggestion and still getting exact same error. Do you have other solution?
you're not getting an error you are getting a warning. you can ignore them the warming but please check if log file is been made?
I have following in my file and even after applying the changes you gave it is not working:
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
--Can you please provide some help? If needed can we get this resolved via skype session.
there is no log file created at all. Can you Please help me figure this out some how?
I also got same issue in window and I found the solution below:
click on the "Run" menu at the top of Eclipse and click on the following:
Run>Run Configurations>Classpath (tab)>User Entries>Advanced (button on the right)>Add Folders>then navigate to the folder that contains your log4j.properties file>Apply>Run
its a warning it will remain the same no matter what the error.
if you are on windows zip and send me the project.
Run it like below and log file will be created. I also dont have any warning when i run it like this.
click on the "Run" menu at the top of Eclipse and click on the following:
Run >Run Configurations >Classpath (tab) >User Entries > Advanced (button on the right) > Add Folders
then navigate to the folder that contains your log4j.properties file (config folder) >Apply >Run