Page 1 of 1

Disabling the log files in PM 3.1 and later

Posted: Thu Dec 07, 2017 12:16 am
by amosbatto
NOTE: this problem is solved in version 3.3.0 and later, so only use these instructions for PM 3.1 - 3.2. See: https://wiki.processmaker.com/3.3/Proce ... _On_or_Off

ProcessMaker added a new logging feature in version 3.1 and later to document every action taken by ProcessMaker. The log files are located at:
{install-directory}/processmaker/shared/sites/{workspace}/log/processmaker-YYYY-MM-DD.log
For example:
/opt/processmaker/shared/sites/workflow/log/processmaker-2017-09-19.log

This new logging is useful if your organization needs auditing of actions in ProcessMaker, but it also slows down ProcessMaker and consumes a large amount of disk space on the server.

If wishing to turn off the new logging, then edit the file {install-directory}/processmaker/gulliver/system/class.bootstrap.php with a plain text editor.
Changes lines 2945 - 2951 from:
Code: Select all
    public static function registerMonolog($channel, $level, $message, $context, $ws, $file = 'cron.log', $pathData = PATH_DATA)
    {
        $fileLog = $pathData .'sites'. PATH_SEP . $ws . PATH_SEP . 'log' . PATH_SEP . $file;

        $registerLogger = &MonologProvider::getSingleton($channel, $fileLog);
        $registerLogger->addLog($level, $message, $context);
    }
To:
Code: Select all
    public static function registerMonolog($channel, $level, $message, $context, $ws, $file = 'cron.log', $pathData = PATH_DATA)
    {
        $fileLog = $pathData .'sites'. PATH_SEP . $ws . PATH_SEP . 'log' . PATH_SEP . $file;

        //$registerLogger = &MonologProvider::getSingleton($channel, $fileLog);
        //$registerLogger->addLog($level, $message, $context);
    }
Now ProcessMaker won't add content to the log files.

Re: Disabling the log files in PM 3.1 and later

Posted: Thu Dec 07, 2017 12:24 am
by programerboy
Thanks Amos

Re: Disabling the log files in PM 3.1 and later

Posted: Thu Dec 07, 2017 1:39 am
by amosbatto
If you want logging to be configurable from the env.ini file, then edit processmaker/workflow/engine/classes/class.system.php and add a "log_file" option by changing lines 52-84 from:
Code: Select all
    private static $defaultConfig = array(
        'debug' => 0,
        'debug_sql' => 0,
        'debug_time' => 0,
        'debug_calendar' => 0,
        'wsdl_cache' => 1,
        'memory_limit' => "256M",
        'time_zone' => 'America/New_York',
        'expiration_year' => '1',
        'memcached' => 0,
        'memcached_server' => '',
        'default_skin' => 'neoclassic',
        'default_lang' => 'en',
        'proxy_host' => '',
        'proxy_port' => '',
        'proxy_user' => '',
        'proxy_pass' => '',
        'size_log_file' => 5000000,
        'number_log_file' => 5,
        'ie_cookie_lifetime' => 1,
        'safari_cookie_lifetime' => 1,
        'error_reporting' => "",
        'display_errors' => 'On',
        'enable_blacklist' => 0,
        'system_utc_time_zone' => 0,
        'server_protocol' => '',
        'leave_case_warning' => 0,
        'server_hostname_requests_frontend' => '',
        'load_headers_ie' => 0,
        'redirect_to_mobile' => 0,
        'disable_php_upload_execution' => 0,
        'disable_download_documents_session_validation' => 0
    );
 
To:
Code: Select all
    private static $defaultConfig = array(
        'debug' => 0,
        'debug_sql' => 0,
        'debug_time' => 0,
        'debug_calendar' => 0,
        'wsdl_cache' => 1,
        'memory_limit' => "256M",
        'time_zone' => 'America/New_York',
        'expiration_year' => '1',
        'memcached' => 0,
        'memcached_server' => '',
        'default_skin' => 'neoclassic',
        'default_lang' => 'en',
        'proxy_host' => '',
        'proxy_port' => '',
        'proxy_user' => '',
        'proxy_pass' => '',
        'log_file'   => 'all',  //add this line
        'size_log_file' => 5000000,
        'number_log_file' => 5,
        'ie_cookie_lifetime' => 1,
        'safari_cookie_lifetime' => 1,
        'error_reporting' => "",
        'display_errors' => 'On',
        'enable_blacklist' => 0,
        'system_utc_time_zone' => 0,
        'server_protocol' => '',
        'leave_case_warning' => 0,
        'server_hostname_requests_frontend' => '',
        'load_headers_ie' => 0,
        'redirect_to_mobile' => 0,
        'disable_php_upload_execution' => 0,
        'disable_download_documents_session_validation' => 0
    );
 
Then, edit processmaker/gulliver/system/class.bootstrap.php and change lines 2945-2951 from:
Code: Select all
    public static function registerMonolog($channel, $level, $message, $context, $ws, $file = 'cron.log', $pathData = PATH_DATA)
    {
        $fileLog = $pathData .'sites'. PATH_SEP . $ws . PATH_SEP . 'log' . PATH_SEP . $file;

        $registerLogger = &MonologProvider::getSingleton($channel, $fileLog);
        $registerLogger->addLog($level, $message, $context);
    } 
To:
Code: Select all
    public static function registerMonolog($channel, $level, $message, $context, $ws, $file = 'cron.log', $pathData = PATH_DATA)
    {
        $fileLog = $pathData .'sites'. PATH_SEP . $ws . PATH_SEP . 'log' . PATH_SEP . $file;
        $aSysConf = \System::getSystemConfiguration();

        if ($aSysConf['log_file'] == 'all' or $aSysConf['log_file'] == '' or
           ($aSysConf['log_file'] == 'errors' and $level >= 400)) 
        {
            $registerLogger = &MonologProvider::getSingleton($channel, $fileLog);
            $registerLogger->addLog($level, $message, $context);
        }
    } 
Then, you can edit your workflow/engine/config/env.ini file and add one of the following lines to set the level of logging:
Code: Select all
log_file = "off"
log_file = "all"
log_file = "errors"

Re: Disabling the log files in PM 3.1 and later

Posted: Fri Dec 08, 2017 8:47 am
by programerboy
Hi,
Please tell to processmaker team for create these changes to next version.
Thanks

Re: Disabling the log files in PM 3.1 and later

Posted: Fri Dec 08, 2017 10:09 pm
by amosbatto
programerboy wrote:Hi,
Please tell to processmaker team for create these changes to next version.
Thanks
I filed a bug report about it: https://processmaker.atlassian.net/browse/TRI-2461

Re: Disabling the log files in PM 3.1 and later

Posted: Sat Oct 13, 2018 11:48 pm
by rafaelot009
programerboy wrote: Fri Dec 08, 2017 8:47 am Hi,
Please tell to processmaker team for solution surendettement create these changes to next version.
Thanks
Hello!
This is my first time here and I just want to say that I’m very happy to be here and to share my opinion.
Thanks!

Re: Disabling the log files in PM 3.1 and later

Posted: Tue Sep 17, 2019 6:47 pm
by Amarilisis
Hola, hay alguna forma de hacer que estos log se compriman automáticamente?

Re: Disabling the log files in PM 3.1 and later

Posted: Tue Sep 17, 2019 7:34 pm
by amosbatto
Amarilisis wrote:Hola, hay alguna forma de hacer que estos log se compriman automáticamente?
Puedes cambiar el codigo fuente para comprimir los archivos de bitacora, pero no será una buena idea porque PM tiene que descomprimir el archivo, agregar texto nuevo y comprimirlo de nuevo. El rendimiento sería horrible.

Si no tienes espacio en tu disco duro y estas usando versión 3.3.0 o después, puedes setear en tu archivo env.ini:
Code: Select all
logs_max_files=20
logging_level="ERROR"
Ver: https://wiki.processmaker.com/3.3/Proce ... _On_or_Off