0

I always get an error about this

log4j:WARN No appenders could be found for logger (net.sf.jasperreports.engine.xml.JRXmlDigesterFactory). log4j:WARN Please initialize the log4j system properly.

i dont know where is that log4j.properties is. is it downloadable? becouse i currently have zip pack named jasperreports-4.7.0,there are so many library there,but which one of it? please help me. i have no luck finding it in google. i have method that shows the table of my database

pubic void btnIreport(){

try{
    JasperDesign jd = JRXmlLoader.load("C:\\Users\\Nickz08\\Desktop\\test.jrpxml");
    String sql = "select * from tblStudentAccount order by name";
    JRDesignQuery newQuery = new JRDesignQuery();
    newQuery.setText(sql);
    jd.setQuery(newQuery);
    JasperReport jr = JasperCompileManager.compileReport(jd);
    JasperPrint jp = JasperFillManager.fillReport(jr, null,conn);
    JasperViewer.viewReport(jp);

}catch(Exception e){
    e.printStackTrace();

}}
user3053928
  • 11
  • 1
  • 4

3 Answers3

0

Try to create log4j.properties file in your src folder it might solve your issue.

Noman ali abbasi
  • 539
  • 2
  • 13
0

It has to be in your classpath. Check for it over there.

Helios
  • 851
  • 2
  • 7
  • 22
0

Read the following link how to create a log4j.properties file (No appenders could be found for logger(log4j)?)

you can add it any where you want, when you run your project, configure the classpath and add the location of the log4j.properties files by clicking on: Run->Run Configuration -> [classpath tab] -> click on user Entries -> Advanced -> Select Add Folder -> select the location of your log4j.properties file

and then -> OK -> run

and it should get loaded

Community
  • 1
  • 1
sasankad
  • 3,543
  • 3
  • 24
  • 31
  • how to insert it in line of code? like this `PropertyConfigurator.configure("C:\Users\Nickz08\Desktop\log4j-1.2.15");` – user3053928 Dec 23 '13 at 04:39
  • @user3053928, you can set it using System.setProperty(), but it has to be set before the first call to any logging method (which is usually pretty hard to achieve). – sasankad Dec 23 '13 at 04:44