Always log install log to base log folder

This commit is contained in:
Clemente Raposo 2025-01-14 13:13:15 +00:00 committed by c.raposo
parent daabfa9819
commit a549d23644
3 changed files with 72 additions and 1 deletions

View file

@ -8,7 +8,7 @@ monolog:
channels: [ "upgrade" ]
install:
type: stream
path: "%env(default:log.dir:env.logs:LOG_DIR)%/install.log"
path: "%env(default:base.log.dir:env.base_logs:LOG_DIR)%/install.log"
level: debug
channels: [ "install" ]
auth:

View file

@ -10,6 +10,7 @@ parameters:
default_session_name: 'SCRMSESSID'
auth_type: '%env(AUTH_TYPE)%'
log.dir: '%kernel.logs_dir%'
base.log.dir: '%kernel.project_dir%/logs'
log.main.default: '%kernel.environment%.log'
log.security.default: '%kernel.environment%.security.log'
log.deprecation.default: '%kernel.environment%.deprecation.log'

View file

@ -0,0 +1,70 @@
<?php
/**
* SuiteCRM is a customer relationship management program developed by SalesAgility Ltd.
* Copyright (C) 2025 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SALESAGILITY, SALESAGILITY DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see http://www.gnu.org/licenses.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Supercharged by SuiteCRM" logo. If the display of the logos is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Supercharged by SuiteCRM".
*/
namespace App\Logging\Services;
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
class BaseLoggingEnvVarProcessor implements EnvVarProcessorInterface
{
protected string $projectDir;
public function __construct(
string $projectDir = ''
) {
$this->projectDir = $projectDir;
}
public function getEnv(string $prefix, string $name, \Closure $getEnv): string
{
$env = $getEnv($name);
if ($env === null) {
return '';
}
if ($env[0] === '/') {
return $env;
}
$baseDir = __DIR__. '../../../../../';
if (!empty($this->projectDir)) {
$baseDir = $this->projectDir . '/';
}
return $baseDir;
}
public static function getProvidedTypes(): array
{
return [
'env.base_logs' => 'string',
];
}
}