if (this.out == null) { synchronized ( this.lock ) { String url = null; String root = null; Enumeration enumeration = FileSystemRegistry.listRoots(); String roots = "";  while (enumeration.hasMoreElements()) { root = (String) enumeration.nextElement(); roots += root + "; ";  break;  }   root = (String) enumeration.nextElement();    url = "file:    url = "file:  FileConnection connection = null; connection = (FileConnection) Connector.open( url, Connector.READ_WRITE ); if (!connection.exists()) {  connection.create(); }  this.out = new PrintStream( connection.openOutputStream() ); this.out.println("time\tlevel\tclass\tline\tmessage\terror");  }
if (this.scheduledLogEntries == null) { this.scheduledLogEntries = new ArrayList( 7 ); Thread thread = new Thread( this ); thread.start();
	public void handleLogEntry(LogEntry entry) throws Exception {		if (this.out == null) {			synchronized ( this.lock ) {				String url = null;				String root = null;				Enumeration enumeration = FileSystemRegistry.listRoots();				String roots = "";				//#if polish.log.file.preferredRoot:defined					while (enumeration.hasMoreElements()) {						root = (String) enumeration.nextElement();						roots += root + "; ";						//#= if  ( root.startsWith( "${polish.log.file.preferredRoot}" )) {							break;						//#= }					}									//#else									root = (String) enumeration.nextElement();				//#endif								//#if polish.log.file.useUnqiueName == true					url = "file:///" + root + "j2melog" + System.currentTimeMillis() + ".txt";				//#elif polish.log.file.fileName:defined					//#= url = "file:///" + root + "${polish.log.file.fileName}";				//#else					url = "file:///" + root + "j2melog.txt";				//#endif				FileConnection connection = null;				connection = (FileConnection) Connector.open( url, Connector.READ_WRITE );				if (!connection.exists()) {					//System.out.println("Creating file...");					connection.create();				}				//System.out.println("opening data output stream...");				this.out = new PrintStream( connection.openOutputStream() );				this.out.println("time\tlevel\tclass\tline\tmessage\terror");				//this.out.println( roots );			}		}		StringBuffer buffer = new StringBuffer();							buffer.append( entry.time ).append('\t')			.append( entry.level ).append('\t')			.append( entry.className ).append('\t')			.append( entry.lineNumber ).append('\t')			.append( entry.message ).append('\t')			.append( entry.exception );		this.out.println( buffer.toString() );				//this.out.close();		//this.out = null;	}