I try to make report with ireport but i get this problem:
log4j:WARN No appenders could be found for logger(net.sf.jasperreports.extensions.ExtensionsEnvironment). log4j:WARN Please initialize the log4j system properly.
My source:
private URL[] reports = new URL[]{
getClass().getResource("/Laporan/LapGuru.Jasper"),
getClass().getResource("/Laporan/LapGuruByNIP.Jasper"),};
private URL urlCurrent;
try{
Map parameter = new HashMap();
parameter.put("nip",this.txtNIP.getText());
InputStream os = null;
os = urlCurrent.openStream();
JasperReport jReport = (JasperReport)JRLoader.loadObject(os);
JasperPrint jPrint = JasperFillManager.fillReport(jReport, parameter, ClassDB.getkoneksi());
JRViewer viewer = new JRViewer(jPrint);
viewer.setOpaque(true);
viewer.setVisible(true);
jScrollPane1.add(viewer);
jScrollPane1.setViewportView(viewer);
} catch (Exception ex)
{
System.out.println(ex);
}
Make sure you have log4j.properties
file in your classpath.
There are also other options to configure log4j if you want to name however you want add a System property to the command line when you start Java, like this:
-Dlog4j.configuration=file:///path/to/your/log4j.properties
See the link http://logging.apache.org/log4j/1.2/manual.html#defaultInit