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