try {
File logfile = new File("C:\\temp\\serverLogfile");
OutputStream outputStream = new FileOutputStream(logfile);
Printer realPrinter = new NullPrinter(outputStream);
Printer batchingPrinter = new BatchingPrinter(realPrinter);
Naming.rebind(DEFAULT_PRINTER_NAME, batchingPrinter);
} catch (Exception e) {
e.printStackTrace();
}