synchronized public void updateLog() {

		try {
			PrintWriter writer = new PrintWriter("log.txt", "UTF-8");
			writer.println("allocatedmemory: " + this.maxSize);
			writer.println("usedmemory: " + this.currSize);
			writer.println("lastchunk: " + this.nextAvailableFileNo);
			for(BackupFile file : files) {
				writer.println("file: " + Packet.bytesToHex(file.getFileID()) + " " + file.getFilename() + " " + file.getReplicationDegree() + " " + file.getNumChunks());
			}
			for(BackupChunk chunk : backedUpChunks) {
				String chunkData = "chunk: " + Packet.bytesToHex(chunk.getFileID()) + " " + chunk.getFilename() + " " + chunk.getChunkNo() + " " + chunk.getWantedReplicationDegree() + " " + chunk.getRepDeg() + " " + chunk.getSize();

				for(InetAddress addr : chunk.getStored()) {
					chunkData += " " + addr.getHostAddress();
				}
				writer.println(chunkData);
			}
			writer.close();
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}