BUG-13506 Corrección y aplicación de formato

This commit is contained in:
Roly Rudy Gutierrez Pinto
2013-11-25 17:58:52 -04:00
parent dc7e950351
commit 18969ebbce
3 changed files with 11 additions and 9 deletions

View File

@@ -5261,7 +5261,7 @@ class G
$config = System::getSystemConfiguration(); $config = System::getSystemConfiguration();
G::LoadSystem('logger'); G::LoadSystem('logger');
$oLogger = logger::getSingleton($pathData, PATH_SEP, $file); $oLogger =& Logger::getSingleton($pathData, PATH_SEP, $file);
$oLogger->limitFile = $config['number_log_file']; $oLogger->limitFile = $config['number_log_file'];
$oLogger->limitSize = $config['size_log_file']; $oLogger->limitSize = $config['size_log_file'];
$oLogger->write($message); $oLogger->write($message);

View File

@@ -14,7 +14,7 @@
* @author Roly Rudy Gutierrez Pinto * @author Roly Rudy Gutierrez Pinto
* @package gulliver.system * @package gulliver.system
*/ */
class logger class Logger
{ {
public static $instance = null; public static $instance = null;
@@ -31,10 +31,10 @@ class logger
{ {
$this->limitFile = 5; $this->limitFile = 5;
$this->limitSize = 1000000; $this->limitSize = 1000000;
$filename = explode(".", $file); $filename = pathinfo($file);
if (isset($filename[0]) && isset($filename[1])) { if (isset($filename['filename']) && isset($filename['extension'])) {
$this->fileName = $filename[0]; $this->fileName = $filename['filename'];
$this->fileExtension = '.' . $filename[1]; $this->fileExtension = '.' . $filename['extension'];
} else { } else {
$this->fileName = 'cron'; $this->fileName = 'cron';
$this->fileExtension = '.log'; $this->fileExtension = '.log';
@@ -49,7 +49,7 @@ class logger
public function getSingleton($pathData, $pathSep, $file = 'cron.log') public function getSingleton($pathData, $pathSep, $file = 'cron.log')
{ {
if (self::$instance == null) { if (self::$instance == null) {
self::$instance = new logger($pathData, $pathSep, $file); self::$instance = new Logger($pathData, $pathSep, $file);
} }
return self::$instance; return self::$instance;
} }

View File

@@ -1417,13 +1417,15 @@ class workspaceTools
public function backupLogFiles() public function backupLogFiles()
{ {
$config = System::getSystemConfiguration();
clearstatcache(); clearstatcache();
$path = PATH_DATA . "log" . PATH_SEP; $path = PATH_DATA . "log" . PATH_SEP;
$filePath = $path . "cron.log"; $filePath = $path . "cron.log";
if (file_exists($filePath)) { if (file_exists($filePath)) {
$size = filesize($filePath); $size = filesize($filePath);
/* 5000000 -> approximately 5 megabytes */ /* $config['size_log_file'] has the value 5000000 -> approximately 5 megabytes */
if ($size > 5000000) { if ($size > $config['size_log_file']) {
rename($filePath, $filePath . ".bak"); rename($filePath, $filePath . ".bak");
} }
} }