From f6defce82d5cd74fbf444b92ee73be33103d271e Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Thu, 4 Aug 2022 16:38:15 +0200 Subject: [PATCH] baculum: Improve logging and add audit log --- .../protected/API/Modules/BaculaConfig.php | 5 +- .../protected/API/Modules/BaculaSetting.php | 10 +- .../API/Modules/BaculumAPIServer.php | 32 +++-- .../protected/API/Modules/BasicConfig.php | 5 +- .../protected/API/Modules/Bconsole.php | 8 +- .../protected/API/Modules/ChangerCommand.php | 5 +- .../API/Modules/ComponentActions.php | 5 +- .../protected/API/Modules/Database.php | 5 +- .../protected/API/Modules/JSONTools.php | 10 +- .../API/Modules/OAuth2/OAuth2Config.php | 5 +- .../protected/API/Pages/API/config.xml | 3 +- .../protected/API/Pages/OAuth2/config.xml | 5 + .../protected/API/Pages/Panel/config.xml | 3 +- .../Common/Modules/BFileLogRoute.php | 44 +++++++ .../protected/Common/Modules/ConfigIni.php | 5 +- gui/baculum/protected/Common/Modules/Ldap.php | 5 +- .../protected/Common/Modules/Logging.php | 109 +++++++++++++----- .../Common/Modules/SessionRecord.php | 10 +- .../Web/Modules/BaculumAPIClient.php | 15 +-- .../Web/Modules/DataDependencies.php | 5 +- .../protected/Web/Modules/HostConfig.php | 5 +- .../protected/Web/Modules/MessagesLog.php | 20 +--- .../protected/Web/Modules/WebConfig.php | 5 +- .../protected/Web/Modules/WebRoleConfig.php | 5 +- .../protected/Web/Modules/WebUserConfig.php | 5 +- .../protected/Web/Modules/WebUserManager.php | 5 +- gui/baculum/protected/Web/Pages/Security.php | 10 +- .../protected/Web/Pages/WebConfigWizard.php | 15 +-- gui/baculum/protected/Web/Pages/config.xml | 2 +- .../Web/Portlets/BaculaConfigDirectives.php | 5 +- 30 files changed, 204 insertions(+), 167 deletions(-) create mode 100644 gui/baculum/protected/Common/Modules/BFileLogRoute.php diff --git a/gui/baculum/protected/API/Modules/BaculaConfig.php b/gui/baculum/protected/API/Modules/BaculaConfig.php index c815f2bb4..2a029f686 100644 --- a/gui/baculum/protected/API/Modules/BaculaConfig.php +++ b/gui/baculum/protected/API/Modules/BaculaConfig.php @@ -106,11 +106,8 @@ class BaculaConfig extends ConfigFileModule { $error = is_array($result['output']) ? implode('', $result['output']) : $result['output']; $emsg = "ERROR [$component_type] $error"; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } return $ret; diff --git a/gui/baculum/protected/API/Modules/BaculaSetting.php b/gui/baculum/protected/API/Modules/BaculaSetting.php index 5c8936d89..dbf71cb4c 100644 --- a/gui/baculum/protected/API/Modules/BaculaSetting.php +++ b/gui/baculum/protected/API/Modules/BaculaSetting.php @@ -384,11 +384,8 @@ class BaculaSetting extends APIModule { } else { // It shouldn't happen. $this->getModule('logging')->log( - __FUNCTION__, - "Attemp to update resource with different resource types.", Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + 'Attemp to update resource with different resource types.' ); $resource = $resource_orig; } @@ -497,11 +494,8 @@ class BaculaSetting extends APIModule { } else { $emsg = sprintf("Attemp to format a directive value with not supported value type '%s'.", gettype($value)); $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } return $directive_value; diff --git a/gui/baculum/protected/API/Modules/BaculumAPIServer.php b/gui/baculum/protected/API/Modules/BaculumAPIServer.php index ba8d5b5df..47e36a03a 100644 --- a/gui/baculum/protected/API/Modules/BaculumAPIServer.php +++ b/gui/baculum/protected/API/Modules/BaculumAPIServer.php @@ -212,14 +212,7 @@ abstract class BaculumAPIServer extends TPage { break; } } - } catch(TException $e) { - $this->getModule('logging')->log( - __FUNCTION__, - "Method: {$_SERVER['REQUEST_METHOD']} $e", - Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ - ); + } catch (TException $e) { if ($e instanceof BAPIException) { $this->output = $e->getErrorMessage(); $this->error = $e->getErrorCode(); @@ -261,6 +254,8 @@ abstract class BaculumAPIServer extends TPage { } else { $json = json_encode($output); } + $out = json_encode($output, JSON_PRETTY_PRINT); + $this->audit($out); return $json; } @@ -285,6 +280,27 @@ abstract class BaculumAPIServer extends TPage { echo $this->getOutput(); } + /** + * Write each request output to audit log. + * This method is dedicated for logging requests to API. + * + * @param string $output output string + */ + private function audit($output) { + $username = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : '-'; + $msg = sprintf( + "[%s] %s %s\n%s", + $_SERVER['REQUEST_METHOD'], + $username, + $this->Request->getRequestUri(), + $output + ); + $this->getModule('logging')->log( + Logging::CATEGORY_AUDIT, + $msg + ); + } + /** * Shortcut method for getting application modules instances by * module name. diff --git a/gui/baculum/protected/API/Modules/BasicConfig.php b/gui/baculum/protected/API/Modules/BasicConfig.php index d98ebc9a8..21a5041ec 100644 --- a/gui/baculum/protected/API/Modules/BasicConfig.php +++ b/gui/baculum/protected/API/Modules/BasicConfig.php @@ -122,11 +122,8 @@ class BasicConfig extends ConfigFileModule { $is_valid = false; $emsg = 'Invalid Basic user config. Missing ' . $this->required_options[$i] . ' option.'; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); break; } diff --git a/gui/baculum/protected/API/Modules/Bconsole.php b/gui/baculum/protected/API/Modules/Bconsole.php index 1111c75f4..ca15b71b2 100644 --- a/gui/baculum/protected/API/Modules/Bconsole.php +++ b/gui/baculum/protected/API/Modules/Bconsole.php @@ -202,6 +202,7 @@ class Bconsole extends APIModule { private function execCommand($director, array $command, $ptype = null) { $cmd = ''; $result = null; + $output = []; if(!is_null($director) && $this->isValidDirector($director) === false) { throw new BConsoleException( BconsoleError::MSG_ERROR_INVALID_DIRECTOR, @@ -215,7 +216,7 @@ class Bconsole extends APIModule { $cmd = $this->getCommand($pattern, $sudo, $dir, $bconsole_command); exec($cmd['cmd'], $output, $exitcode); if($exitcode != 0) { - $emsg = ' Output=>' . implode("\n", $output) . ', Exitcode=>' . $exitcode; + $emsg = ' Output=>' . implode(PHP_EOL, $output) . ', Exitcode=>' . $exitcode; throw new BConsoleException( BconsoleError::MSG_ERROR_BCONSOLE_CONNECTION_PROBLEM . $emsg, BconsoleError::ERROR_BCONSOLE_CONNECTION_PROBLEM @@ -232,11 +233,8 @@ class Bconsole extends APIModule { } } $this->Application->getModule('logging')->log( - $cmd['cmd'], - $output, Logging::CATEGORY_EXECUTE, - __FILE__, - __LINE__ + Logging::prepareOutput($cmd['cmd'], $output) ); return $result; diff --git a/gui/baculum/protected/API/Modules/ChangerCommand.php b/gui/baculum/protected/API/Modules/ChangerCommand.php index dae10bcd4..5156a4ccb 100644 --- a/gui/baculum/protected/API/Modules/ChangerCommand.php +++ b/gui/baculum/protected/API/Modules/ChangerCommand.php @@ -294,11 +294,8 @@ class ChangerCommand extends APIModule { public function execCommand($cmd, $ptype = null) { exec($cmd['cmd'], $output, $exitcode); $this->getModule('logging')->log( - $cmd['cmd'], - $output, Logging::CATEGORY_EXECUTE, - __FILE__, - __LINE__ + Logging::prepareOutput($cmd['cmd'], $output) ); if ($ptype === self::PTYPE_BG_CMD) { $output = [ diff --git a/gui/baculum/protected/API/Modules/ComponentActions.php b/gui/baculum/protected/API/Modules/ComponentActions.php index 6dc008034..9ba0e4393 100644 --- a/gui/baculum/protected/API/Modules/ComponentActions.php +++ b/gui/baculum/protected/API/Modules/ComponentActions.php @@ -113,7 +113,10 @@ class ComponentActions extends APIModule { $cmd_pattern = $this->getCmdPattern(); $cmd = sprintf($cmd_pattern, $sudo, $bin); exec($cmd, $output, $exitcode); - $this->getModule('logging')->log($cmd, $output, Logging::CATEGORY_EXECUTE, __FILE__, __LINE__); + $this->getModule('logging')->log( + Logging::CATEGORY_EXECUTE, + Logging::prepareOutput($cmd, $output) + ); $result = $this->prepareResult($output, $exitcode); return $result; } diff --git a/gui/baculum/protected/API/Modules/Database.php b/gui/baculum/protected/API/Modules/Database.php index 329827bb3..c13a7030f 100644 --- a/gui/baculum/protected/API/Modules/Database.php +++ b/gui/baculum/protected/API/Modules/Database.php @@ -77,11 +77,8 @@ class Database extends APIModule { $logmsg = 'DBParams=%s, Connection=%s, TablesFormat=%s'; $msg = sprintf($logmsg, print_r($db_params, true), var_export($is_connection, true), var_export($tables_format, true)); $this->getModule('logging')->log( - __FUNCTION__, - $msg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $msg ); return $is_connection; } diff --git a/gui/baculum/protected/API/Modules/JSONTools.php b/gui/baculum/protected/API/Modules/JSONTools.php index 5accfefe0..792b7dd1d 100644 --- a/gui/baculum/protected/API/Modules/JSONTools.php +++ b/gui/baculum/protected/API/Modules/JSONTools.php @@ -49,7 +49,10 @@ class JSONTools extends APIModule $output_txt = implode('', $output); $out = json_decode($output_txt, true); if (!is_array($out)) { - $this->getModule('logging')->log('Parse output', $output_txt, Logging::CATEGORY_EXTERNAL, __FILE__, __LINE__); + $this->getModule('logging')->log( + Logging::CATEGORY_EXTERNAL, + "Parse output: $output_txt" + ); $out = null; } return $out; @@ -113,7 +116,10 @@ class JSONTools extends APIModule } $cmd = sprintf($cmd_pattern, $sudo, $bin, $cfg, $options); exec($cmd, $output, $exitcode); - $this->getModule('logging')->log($cmd, $output, Logging::CATEGORY_EXECUTE, __FILE__, __LINE__); + $this->getModule('logging')->log( + Logging::CATEGORY_EXECUTE, + Logging::prepareOutput($cmd, $output) + ); if (!empty($config)) { unlink($cfg); if ($exitcode === 0) { diff --git a/gui/baculum/protected/API/Modules/OAuth2/OAuth2Config.php b/gui/baculum/protected/API/Modules/OAuth2/OAuth2Config.php index 05f2ee6ea..b127902fc 100644 --- a/gui/baculum/protected/API/Modules/OAuth2/OAuth2Config.php +++ b/gui/baculum/protected/API/Modules/OAuth2/OAuth2Config.php @@ -120,11 +120,8 @@ class OAuth2Config extends ConfigFileModule { $is_valid = false; $emsg = 'Invalid OAuth2 config. Missing ' . $this->required_options[$i] . ' option.'; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); break; } diff --git a/gui/baculum/protected/API/Pages/API/config.xml b/gui/baculum/protected/API/Pages/API/config.xml index 4df7cbc0c..683b2e0ce 100644 --- a/gui/baculum/protected/API/Pages/API/config.xml +++ b/gui/baculum/protected/API/Pages/API/config.xml @@ -40,7 +40,8 @@ - + + diff --git a/gui/baculum/protected/API/Pages/OAuth2/config.xml b/gui/baculum/protected/API/Pages/OAuth2/config.xml index d502acb1e..591a0f929 100644 --- a/gui/baculum/protected/API/Pages/OAuth2/config.xml +++ b/gui/baculum/protected/API/Pages/OAuth2/config.xml @@ -10,5 +10,10 @@ + + + + + diff --git a/gui/baculum/protected/API/Pages/Panel/config.xml b/gui/baculum/protected/API/Pages/Panel/config.xml index 66e21ad5e..7e7a44dd3 100644 --- a/gui/baculum/protected/API/Pages/Panel/config.xml +++ b/gui/baculum/protected/API/Pages/Panel/config.xml @@ -18,7 +18,8 @@ - + + diff --git a/gui/baculum/protected/Common/Modules/BFileLogRoute.php b/gui/baculum/protected/Common/Modules/BFileLogRoute.php new file mode 100644 index 000000000..0096867dd --- /dev/null +++ b/gui/baculum/protected/Common/Modules/BFileLogRoute.php @@ -0,0 +1,44 @@ + + * @category Module + * @package Baculum Common + */ +class BFileLogRoute extends TFileLogRoute { + + protected function formatLogMessage($message, $level, $category, $time) { + $t = date('Y-m-d H:i:s'); + $c = sprintf('[%s]', $category); + return join( + ' ', + [$t, $c, $message] + ); + } +} diff --git a/gui/baculum/protected/Common/Modules/ConfigIni.php b/gui/baculum/protected/Common/Modules/ConfigIni.php index d0168c016..7ca7713c8 100644 --- a/gui/baculum/protected/Common/Modules/ConfigIni.php +++ b/gui/baculum/protected/Common/Modules/ConfigIni.php @@ -163,11 +163,8 @@ class ConfigIni extends CommonModule implements IConfigFormat { } $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } return $valid; diff --git a/gui/baculum/protected/Common/Modules/Ldap.php b/gui/baculum/protected/Common/Modules/Ldap.php index cd64eeb98..fac3592a6 100644 --- a/gui/baculum/protected/Common/Modules/Ldap.php +++ b/gui/baculum/protected/Common/Modules/Ldap.php @@ -252,11 +252,8 @@ class Ldap extends CommonModule { ); $this->error = $emsg; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_EXTERNAL, - __FILE__, - __LINE__ + $emsg ); } diff --git a/gui/baculum/protected/Common/Modules/Logging.php b/gui/baculum/protected/Common/Modules/Logging.php index cfaa6535d..b90dcfae4 100644 --- a/gui/baculum/protected/Common/Modules/Logging.php +++ b/gui/baculum/protected/Common/Modules/Logging.php @@ -23,9 +23,10 @@ namespace Baculum\Common\Modules; use Prado\Prado; +use Prado\Util\TLogger; /** - * Logger class. + * Main logger class. * * @author Marcin Haba * @category Module @@ -33,51 +34,97 @@ use Prado\Prado; */ class Logging extends CommonModule { + /* + * Stores debug enable state. + * + * @var bool + */ public static $debug_enabled = false; + /** + * Log categories. + */ const CATEGORY_EXECUTE = 'Execute'; const CATEGORY_EXTERNAL = 'External'; const CATEGORY_APPLICATION = 'Application'; const CATEGORY_GENERAL = 'General'; const CATEGORY_SECURITY = 'Security'; + const CATEGORY_AUDIT = 'Audit'; - private function getLogCategories() { - $categories = array( - self::CATEGORY_EXECUTE, - self::CATEGORY_EXTERNAL, - self::CATEGORY_APPLICATION, - self::CATEGORY_GENERAL, - self::CATEGORY_SECURITY - ); - return $categories; - } - - public function log($cmd, $output, $category, $file, $line) { - if(self::$debug_enabled !== true) { + /** + * Main log method used to log message. + * + * @param string $category log category + */ + public function log($category, $message) { + if (!$this->isEnabled($category)) { return; } - $current_mode = $this->Application->getMode(); + $this->prepareMessage($category, $message); + Prado::log($message, TLogger::INFO, $category); + } - // switch application to debug mode - $this->Application->setMode('Debug'); + /** + * Check if log is enabled. + * + * @param string $category log category + * @return bool true if log is enabled, otherwise false + */ + private function isEnabled($category) { + $is_enabled = false; + if (self::$debug_enabled === true || $category === self::CATEGORY_AUDIT) { + // NOTE: Audit log is written always, it is not possible to disable it + $is_enabled = true; + } + return $is_enabled; + } - if(!in_array($category, $this->getLogCategories())) { - $category = self::CATEGORY_SECURITY; + /** + * Prepare log to send to log manager. + * + * @param string $category log category + * @param array|string|object &$message log message reference + */ + private function prepareMessage($category, &$message) { + if (is_object($message) || is_array($message)) { + // make a message as string if needed + $message = print_r($message, true); } + if (self::$debug_enabled === true && $category !== self::CATEGORY_AUDIT) { + // If debug enabled, add file and line to log message + $f = ''; + $trace = debug_backtrace(); + if (isset($trace[1]['file']) && isset($trace[1]['line'])) { + $f = sprintf( + '%s:%s:', + basename($trace[1]['file']), + $trace[1]['line'] + ); + } + $message = $f . $message; + } + $message .= PHP_EOL . PHP_EOL; + } - $log = sprintf( - 'Command=%s, Output=%s, File=%s, Line=%d', + /** + * Helper method for preparing logs that come from executing programs or scripts. + * This log consists of command and output. + * Useful for bconsole, b*json... and others. + * + * @param string $cmd command + * @param array|object|string $output command output + * @return string formatted command log + */ + public static function prepareOutput($cmd, $output) { + if (is_array($output)) { + $output = implode(PHP_EOL, $output); + } elseif(is_object($output)) { + $output = print_r($output, true); + } + return sprintf( + "\n\n===> Command:\n\n%s\n\n===> Output:\n\n%s", $cmd, - print_r($output, true), - $file, - intval($line) + $output ); - - Prado::trace($log, $category); - - // switch back application to original mode - $this->Application->setMode($current_mode); } } - -?> diff --git a/gui/baculum/protected/Common/Modules/SessionRecord.php b/gui/baculum/protected/Common/Modules/SessionRecord.php index 58faaa7a4..7329ac6ac 100644 --- a/gui/baculum/protected/Common/Modules/SessionRecord.php +++ b/gui/baculum/protected/Common/Modules/SessionRecord.php @@ -68,11 +68,8 @@ class SessionRecord extends CommonModule implements ISessionItem { } else { $emsg = 'Unable to exclusive lock ' . $sessfile; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } fclose($fp); @@ -94,11 +91,8 @@ class SessionRecord extends CommonModule implements ISessionItem { } else { $emsg = 'Unable to shared lock ' . $sessfile; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } fclose($fp); diff --git a/gui/baculum/protected/Web/Modules/BaculumAPIClient.php b/gui/baculum/protected/Web/Modules/BaculumAPIClient.php index 885e0619d..61c19cf87 100644 --- a/gui/baculum/protected/Web/Modules/BaculumAPIClient.php +++ b/gui/baculum/protected/Web/Modules/BaculumAPIClient.php @@ -173,11 +173,8 @@ class BaculumAPIClient extends WebModule { $this->addSpecialParams($uri); $this->Application->getModule('logging')->log( - __FUNCTION__, - PHP_EOL . PHP_EOL . 'EXECUTE URI ==> ' . $uri . ' <==' . PHP_EOL . PHP_EOL, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + 'REQUEST URI => ' . $uri ); } return $uri; @@ -433,11 +430,8 @@ class BaculumAPIClient extends WebModule { private function preParseOutput($result, $error, $errno, $show_error = true) { // first write log with that what comes $this->Application->getModule('logging')->log( - __FUNCTION__, - $result, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $result ); // decode JSON to object @@ -462,11 +456,8 @@ class BaculumAPIClient extends WebModule { } $this->Application->getModule('logging')->log( - __FUNCTION__, - $resource, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $resource ); return $resource; diff --git a/gui/baculum/protected/Web/Modules/DataDependencies.php b/gui/baculum/protected/Web/Modules/DataDependencies.php index be4df0f42..307f71159 100644 --- a/gui/baculum/protected/Web/Modules/DataDependencies.php +++ b/gui/baculum/protected/Web/Modules/DataDependencies.php @@ -61,7 +61,10 @@ class DataDependencies extends WebModule { $data_deps = json_decode($deps_file); } else { $emsg = "Data dependencies file '$deps_file' does not exist or is not readable."; - $this->Application->getModule('logging')->log(__FUNCTION__, $emsg, Logging::CATEGORY_APPLICATION, __FILE__, __LINE__); + $this->Application->getModule('logging')->log( + Logging::CATEGORY_APPLICATION, + $emsg + ); } return $data_deps; } diff --git a/gui/baculum/protected/Web/Modules/HostConfig.php b/gui/baculum/protected/Web/Modules/HostConfig.php index 48630a57c..0a2e5f934 100644 --- a/gui/baculum/protected/Web/Modules/HostConfig.php +++ b/gui/baculum/protected/Web/Modules/HostConfig.php @@ -175,11 +175,8 @@ class HostConfig extends ConfigFileModule { $emsg = "ERROR [$path] Internal error"; } $this->Application->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } return $valid; diff --git a/gui/baculum/protected/Web/Modules/MessagesLog.php b/gui/baculum/protected/Web/Modules/MessagesLog.php index 312f74b1e..a99eafe5d 100644 --- a/gui/baculum/protected/Web/Modules/MessagesLog.php +++ b/gui/baculum/protected/Web/Modules/MessagesLog.php @@ -79,11 +79,8 @@ class MessagesLog extends WebModule { } else { $emsg = 'Could not get the exclusive lock: ' . $f; $this->Application->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } fclose($fp); @@ -103,11 +100,8 @@ class MessagesLog extends WebModule { } else { $emsg = 'Could not get the exclusive lock: ' . $f; $this->Application->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } fclose($fp); @@ -129,11 +123,8 @@ class MessagesLog extends WebModule { } else { $emsg = 'Could not get the exclusive lock: ' . $f; $this->Application->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } fclose($fp); @@ -159,11 +150,8 @@ class MessagesLog extends WebModule { } else { $emsg = 'Could not get the shared lock: ' . $f; $this->Application->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } fclose($fp); diff --git a/gui/baculum/protected/Web/Modules/WebConfig.php b/gui/baculum/protected/Web/Modules/WebConfig.php index b84c044b2..ddc79116f 100644 --- a/gui/baculum/protected/Web/Modules/WebConfig.php +++ b/gui/baculum/protected/Web/Modules/WebConfig.php @@ -230,11 +230,8 @@ class WebConfig extends ConfigFileModule { if ($ret !== true) { $emsg = 'Error while saving auth basic config.'; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } return $ret; diff --git a/gui/baculum/protected/Web/Modules/WebRoleConfig.php b/gui/baculum/protected/Web/Modules/WebRoleConfig.php index 247bdf164..8231d76c5 100644 --- a/gui/baculum/protected/Web/Modules/WebRoleConfig.php +++ b/gui/baculum/protected/Web/Modules/WebRoleConfig.php @@ -176,11 +176,8 @@ class WebRoleConfig extends ConfigFileModule { for ($i = 0; $i < $required_len; $i++) { $emsg = "ERROR [$path] Required {$invalid['required'][$i]['type']} '{$invalid['required'][$i]['value']}' not found for role '{$invalid['required'][$i]['role']}."; $this->Application->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } } diff --git a/gui/baculum/protected/Web/Modules/WebUserConfig.php b/gui/baculum/protected/Web/Modules/WebUserConfig.php index d2825ee9d..8f9b3b142 100644 --- a/gui/baculum/protected/Web/Modules/WebUserConfig.php +++ b/gui/baculum/protected/Web/Modules/WebUserConfig.php @@ -245,11 +245,8 @@ class WebUserConfig extends ConfigFileModule { $ret = false; $emsg = 'Error while importing basic users.'; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } return $ret; diff --git a/gui/baculum/protected/Web/Modules/WebUserManager.php b/gui/baculum/protected/Web/Modules/WebUserManager.php index 82d11cfc0..237714874 100644 --- a/gui/baculum/protected/Web/Modules/WebUserManager.php +++ b/gui/baculum/protected/Web/Modules/WebUserManager.php @@ -242,11 +242,8 @@ class WebUserManager extends WebModule implements IUserManager { } else { $emsg = 'Basic auth is enabled, but PHP_AUTH_USER is not set or is empty.'; $this->Application->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_SECURITY, - __FILE__, - __LINE__ + $emsg ); } } diff --git a/gui/baculum/protected/Web/Pages/Security.php b/gui/baculum/protected/Web/Pages/Security.php index 09713d9e7..3982981c3 100644 --- a/gui/baculum/protected/Web/Pages/Security.php +++ b/gui/baculum/protected/Web/Pages/Security.php @@ -836,11 +836,8 @@ class Security extends BaculumWebPage { if (!key_exists($params['user_attr'], $users[$i])) { $emsg = "User attribute '{$params['user_attr']}' doesn't exist in LDAP response."; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_EXTERNAL, - __FILE__, - __LINE__ + $emsg ); continue; } @@ -848,11 +845,8 @@ class Security extends BaculumWebPage { if ($params['user_attr'] !== Ldap::DN_ATTR && $users[$i][$params['user_attr']]['count'] != 1) { $emsg = "Invalid user attribute count for '{$params['user_attr']}'. Is {$users[$i][$params['user_attr']]['count']}, should be 1."; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_EXTERNAL, - __FILE__, - __LINE__ + $emsg ); continue; diff --git a/gui/baculum/protected/Web/Pages/WebConfigWizard.php b/gui/baculum/protected/Web/Pages/WebConfigWizard.php index e4a9177eb..aaf36647e 100644 --- a/gui/baculum/protected/Web/Pages/WebConfigWizard.php +++ b/gui/baculum/protected/Web/Pages/WebConfigWizard.php @@ -148,11 +148,8 @@ class WebConfigWizard extends BaculumWebPage } else { $emsg = 'Error while saving basic user config.'; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } @@ -168,11 +165,8 @@ class WebConfigWizard extends BaculumWebPage if (!$ret) { $emsg = 'Error while saving user config.'; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } @@ -185,11 +179,8 @@ class WebConfigWizard extends BaculumWebPage } else { $emsg = 'Error while saving auth host config.'; $this->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } } diff --git a/gui/baculum/protected/Web/Pages/config.xml b/gui/baculum/protected/Web/Pages/config.xml index 804728fcb..21502937e 100644 --- a/gui/baculum/protected/Web/Pages/config.xml +++ b/gui/baculum/protected/Web/Pages/config.xml @@ -17,7 +17,7 @@ - + diff --git a/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php b/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php index 2f1c1b542..62a68f115 100644 --- a/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php +++ b/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php @@ -609,11 +609,8 @@ class BaculaConfigDirectives extends DirectiveListTemplate { $success = false; $emsg = 'Error while renaming resource: ' . $result->output; $this->Application->getModule('logging')->log( - __FUNCTION__, - $emsg, Logging::CATEGORY_APPLICATION, - __FILE__, - __LINE__ + $emsg ); } return $success; -- 2.47.3