Index: /sandbox/trunk/pdp/src/N-body.cpp
===================================================================
--- /sandbox/trunk/pdp/src/N-body.cpp (revision 954)
+++ /sandbox/trunk/pdp/src/N-body.cpp (revision 955)
@@ -196,5 +196,6 @@
 		OPT_DISTRIBUTE,
 		OPT_STEP,
-		OPT_NUM_PARTICLE
+		OPT_NUM_PARTICLE,
+		OPT_LOGLEVEL
 	};
     OptionParser opt;
@@ -204,4 +205,5 @@
 	opt.add(OptionWithArgument(OPT_STEP, "s", "step", "STEP", "num calculation steps (default = 100)"));
 	opt.add(OptionWithArgument(OPT_NUM_PARTICLE, "p", "particle", "NUM", "num particles (default = 10)"));
+	opt.add(OptionWithArgument(OPT_LOGLEVEL, "w", "loglevel", "LOGLEVEL", "0:all, 1:trace, 2:debug, 3:info, 4:warn, 5:error, 6:fatal, 7:off)"));
 
 	try
@@ -217,4 +219,9 @@
 		{
 			Logger::getRootLogger()->setLevel("trace");
+		}
+		if(opt.isSet(OPT_LOGLEVEL))
+		{
+			int logLevel = Integer::parseInt(opt.getValue(OPT_LOGLEVEL));
+			Logger::getRootLogger()->setLevel(logLevel);
 		}
 
Index: /sandbox/trunk/pdp/src/Replication.cpp
===================================================================
--- /sandbox/trunk/pdp/src/Replication.cpp (revision 954)
+++ /sandbox/trunk/pdp/src/Replication.cpp (revision 955)
@@ -61,5 +61,6 @@
 		OPT_VERBOSE,
 		OPT_REPLICATION_MODE,
-		OPT_BUFFERSIZE
+		OPT_BUFFERSIZE,
+		OPT_LOGLEVEL
 	};
 
@@ -71,4 +72,5 @@
 		opt.add(OptionWithArgument(OPT_REPLICATION_MODE, "m", "replication", "MODE", " 0 (default) : one to N replication, 1 : chain replication"));
 		opt.add(OptionWithArgument(OPT_BUFFERSIZE, "b", "buffer", "MBYTES", "buffer size (default: 16M)"));
+		opt.add(OptionWithArgument(OPT_LOGLEVEL, "w", "loglevel", "LOGLEVEL", "0:all, 1:trace, 2:debug, 3:info, 4:warn, 5:error, 6:fatal, 7:off)"));
 
 		opt.getContext(argc, argv);
@@ -81,4 +83,9 @@
 		if(opt.getArgumentLength() < 1)
 			XERIAL_THROW(InvalidParameterException, "input file name must be given");
+		if(opt.isSet(OPT_LOGLEVEL))
+		{
+			int logLevel = Integer::parseInt(opt.getValue(OPT_LOGLEVEL));
+			Logger::getRootLogger()->setLevel(logLevel);
+		}
 
 
@@ -234,6 +241,7 @@
 			MPI::INT.Unpack(&(packedDataBuffer[0]), 1, &incomingDataSize, 1, packedBufferPosition, comm);
 			XERIAL_DEBUG(_logger, "incoming bytes = " << incomingDataSize);
-			//MPI::BYTE.Unpack(&(packedDataBuffer[0]), incomingDataSize, &(fileBuffer[0]), _bufferSize, packedBufferPosition, comm);
-			size_t writesize = fwrite(&(packedDataBuffer[packedBufferPosition]), 1, incomingDataSize, file.getHandle());
+			MPI::BYTE.Unpack(&(packedDataBuffer[0]), incomingDataSize, &(fileBuffer[0]), _bufferSize, packedBufferPosition, comm);
+
+			size_t writesize = fwrite(&(fileBuffer[0]), 1, incomingDataSize, file.getHandle());
 			if(writesize != incomingDataSize)
 				XERIAL_THROW(Exception, "write failed. write size =  " << writesize);
