Index: branches/dev/data/conf/conf.php
===================================================================
--- branches/dev/data/conf/conf.php	(revision 152)
+++ branches/dev/data/conf/conf.php	(revision 241)
@@ -180,4 +180,6 @@
 define ("ADMIN_MODE", 0);								// ´ÉÍý¥â¡¼¥É 1:Í­¸ú¡¡0:Ìµ¸ú(Ç¼ÉÊ»þ)
 define ("DAILY_BATCH_MODE", false);						// Çä¾å½¸·×¥Ð¥Ã¥Á¥â¡¼¥É(true:¥Ð¥Ã¥Á¤Ç½¸·×¤¹¤ë ¢¨Í×cronÀßÄê¡¢false:¥ê¥¢¥ë¥¿¥¤¥à¤Ç½¸·×¤¹¤ë)
+define ("MAX_LOG_QUANTITY", 5);							// ¥í¥°¥Õ¥¡¥¤¥ëºÇÂç¿ô(¥í¥°¥Æ¡¼¥·¥ç¥ó)
+define ("MAX_LOG_SIZE", "10000");						// 1¤Ä¤Î¥í¥°¥Õ¥¡¥¤¥ë¤ËÊÝÂ¸¤¹¤ëºÇÂçÍÆÎÌ(byte)
 
 define ("FORGOT_MAIL", 0);								// ¥Ñ¥¹¥ï¡¼¥ÉËº¤ì¤Î³ÎÇ§¥á¡¼¥ë¤òÁ÷ÉÕ¤¹¤ë¤«ÈÝ¤«¡£(0:Á÷¿®¤·¤Ê¤¤¡¢1:Á÷¿®¤¹¤ë)
Index: branches/dev/data/lib/glib.php
===================================================================
--- branches/dev/data/lib/glib.php	(revision 17)
+++ branches/dev/data/lib/glib.php	(revision 241)
@@ -96,4 +96,7 @@
 		fclose( $fp );
 		gfPrintLog("*** end Debug ***");
+
+		// ¥í¥°¥Æ¡¼¥·¥ç¥ó
+		gfLogRotation(MAX_LOG_QUANTITY, MAX_LOG_SIZE, LOG_PATH);
 }
 
@@ -123,4 +126,61 @@
 		fwrite( $fp, $today." [".$_SERVER['PHP_SELF']."] ".$mess." from ". $_SERVER['REMOTE_ADDR']. "\n" );
 		fclose( $fp );
+	}
+	
+	// ¥í¥°¥Æ¡¼¥·¥ç¥ó
+	gfLogRotation(MAX_LOG_QUANTITY, MAX_LOG_SIZE, $path);
+}
+
+/**			
+ * ¥í¥°¥í¡¼¥Æ¡¼¥·¥ç¥óµ¡Ç½			
+ *			
+ * @param integer $max_log ºÇÂç¥Õ¥¡¥¤¥ë¿ô
+ * @param integer $max_size ºÇÂç¥µ¥¤¥º
+ * @param string  $path ¥Õ¥¡¥¤¥ë¥Ñ¥¹
+ * @return void ¤Ê¤·
+ */			
+function gfLogRotation($max_log, $max_size, $path) {
+	
+	// ¥Ç¥£¥ì¥¯¥È¥êÌ¾¤ò¼èÆÀ
+	$dirname = dirname($path);
+	// ¥Õ¥¡¥¤¥ëÌ¾¤ò¼èÆÀ
+	$basename = basename($path);
+	
+	// ¥Õ¥¡¥¤¥ë¤¬ºÇÂç¥µ¥¤¥º¤òÄ¶¤¨¤Æ¤¤¤Ê¤¤¤«¥Á¥§¥Ã¥¯
+	if(filesize($path) > $max_size) {
+		if ($dh = opendir($dirname)) {
+			while (($file = readdir($dh)) !== false) {
+				// ¥í¥°¥í¡¼¥Æ¡¼¥·¥ç¥ó¤Ë¤ÆºîÀ®¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤ò¼èÆÀ
+				if(ereg("^". $basename . "\." , $file)) {
+					$arrLog[] = $file;
+				}
+			}
+			
+			// ¥Õ¥¡¥¤¥ë¥í¥°¤¬ºÇÂç¸Ä¿ô¤Ê¤é°Ê¾å¤Ê¤é¸Å¤¤¥Õ¥¡¥¤¥ë¤«¤éºï½ü¤¹¤ë
+			$count = count($arrLog);
+			if($count >= $max_log) {
+				$diff = $count - $max_log;
+				for($i = 0; $diff >= $i ; $i++) {
+					unlink($dirname. "/" .array_pop($arrLog));
+				}	
+			}
+			
+			// ¥í¥°¥Õ¥¡¥¤¥ë¤ÎÅº¤¨»ú¤ò¤º¤é¤¹
+			$count = count($arrLog);
+			for($i = $count; 1 <= $i; $i--) {
+				$move_number = $i + 1;
+				
+				if(file_exists("$path.$move_number")) unlink("$path.$move_number");
+				copy("$dirname/" . $arrLog[$i - 1], "$path.$move_number");		
+				
+			}
+			$ret = copy($path, "$path.1");
+			
+			// ¿·µ¬¥í¥°¥Õ¥¡¥¤¥ë¤òºîÀ®
+			if($ret) {
+				unlink($path);			
+				touch($path);
+			}
+		}
 	}
 }
