diff --git a/src/admin/index.php b/src/admin/index.php index 6a277af..8a76a2d 100644 --- a/src/admin/index.php +++ b/src/admin/index.php @@ -132,8 +132,9 @@ if ( isset($_POST['op']) ) if ( isset ($_POST['MiscShowDebugGridCounter']) ) { $content['MiscShowDebugGridCounter'] = 1; } else { $content['MiscShowDebugGridCounter'] = 0; } if ( isset ($_POST['MiscShowPageRenderStats']) ) { $content['MiscShowPageRenderStats'] = 1; } else { $content['MiscShowPageRenderStats'] = 0; } if ( isset ($_POST['MiscEnableGzipCompression']) ) { $content['MiscEnableGzipCompression'] = 1; } else { $content['MiscEnableGzipCompression'] = 0; } - if ( isset ($_POST['DebugUserLogin']) ) { $content['DebugUserLogin'] = 1; } else { $content['DebugUserLogin'] = 0; } if ( isset ($_POST['SuppressDuplicatedMessages']) ) { $content['SuppressDuplicatedMessages'] = 1; } else { $content['SuppressDuplicatedMessages'] = 0; } + if ( isset ($_POST['DebugUserLogin']) ) { $content['DebugUserLogin'] = 1; } else { $content['DebugUserLogin'] = 0; } + if ( isset ($_POST['MiscDebugToSyslog']) ) { $content['MiscDebugToSyslog'] = 1; } else { $content['MiscDebugToSyslog'] = 0; } // Read Text number fields if ( isset ($_POST['ViewMessageCharacterLimit']) && is_numeric($_POST['ViewMessageCharacterLimit']) ) { $content['ViewMessageCharacterLimit'] = $_POST['ViewMessageCharacterLimit']; } @@ -177,7 +178,6 @@ if ( isset($_POST['op']) ) if ( isset ($_POST['User_MiscShowDebugGridCounter']) ) { $USERCFG['MiscShowDebugGridCounter'] = 1; } else { $USERCFG['MiscShowDebugGridCounter'] = 0; } if ( isset ($_POST['User_MiscShowPageRenderStats']) ) { $USERCFG['MiscShowPageRenderStats'] = 1; } else { $USERCFG['MiscShowPageRenderStats'] = 0; } if ( isset ($_POST['User_MiscEnableGzipCompression']) ) { $USERCFG['MiscEnableGzipCompression'] = 1; } else { $USERCFG['MiscEnableGzipCompression'] = 0; } -// DISABLED FOR USER! if ( isset ($_POST['User_DebugUserLogin']) ) { $USERCFG['DebugUserLogin'] = 1; } else { $USERCFG['DebugUserLogin'] = 0; } if ( isset ($_POST['User_SuppressDuplicatedMessages']) ) { $USERCFG['SuppressDuplicatedMessages'] = 1; } else { $USERCFG['SuppressDuplicatedMessages'] = 0; } // Read Text number fields @@ -209,8 +209,10 @@ if ($content['MiscShowDebugMsg'] == 1) { $content['MiscShowDebugMsg_checked'] = if ($content['MiscShowDebugGridCounter'] == 1) { $content['MiscShowDebugGridCounter_checked'] = "checked"; } else { $content['MiscShowDebugGridCounter_checked'] = ""; } if ($content['MiscShowPageRenderStats'] == 1) { $content['MiscShowPageRenderStats_checked'] = "checked"; } else { $content['MiscShowPageRenderStats_checked'] = ""; } if ($content['MiscEnableGzipCompression'] == 1) { $content['MiscEnableGzipCompression_checked'] = "checked"; } else { $content['MiscEnableGzipCompression_checked'] = ""; } -if ($content['DebugUserLogin'] == 1) { $content['DebugUserLogin_checked'] = "checked"; } else { $content['DebugUserLogin_checked'] = ""; } if ($content['SuppressDuplicatedMessages'] == 1) { $content['SuppressDuplicatedMessages_checked'] = "checked"; } else { $content['SuppressDuplicatedMessages_checked'] = ""; } + +if ($content['DebugUserLogin'] == 1) { $content['DebugUserLogin_checked'] = "checked"; } else { $content['DebugUserLogin_checked'] = ""; } +if ($content['MiscDebugToSyslog'] == 1) { $content['MiscDebugToSyslog_checked'] = "checked"; } else { $content['MiscDebugToSyslog_checked'] = ""; } // --- // --- Init for Style field! diff --git a/src/classes/logstreamlineparsersyslog.class.php b/src/classes/logstreamlineparsersyslog.class.php index 275e069..7d66b12 100644 --- a/src/classes/logstreamlineparsersyslog.class.php +++ b/src/classes/logstreamlineparsersyslog.class.php @@ -118,7 +118,7 @@ class LogStreamLineParsersyslog extends LogStreamLineParser { else { if ( isset($arrArguments[SYSLOG_MESSAGE]) && strlen($arrArguments[SYSLOG_MESSAGE]) > 0 ) - OutputDebugMessage("Unparseable syslog msg - '" . $arrArguments[SYSLOG_MESSAGE] . "'"); + OutputDebugMessage("Unparseable syslog msg - '" . $arrArguments[SYSLOG_MESSAGE] . "'", DEBUG_ERROR); } // If SyslogTag is set, we check for MessageType! diff --git a/src/classes/logstreamlineparserwinsyslog.class.php b/src/classes/logstreamlineparserwinsyslog.class.php index 35eb8ee..c3b8996 100644 --- a/src/classes/logstreamlineparserwinsyslog.class.php +++ b/src/classes/logstreamlineparserwinsyslog.class.php @@ -88,7 +88,7 @@ class LogStreamLineParserwinsyslog extends LogStreamLineParser { else { if ( isset($arrArguments[SYSLOG_MESSAGE]) && strlen($arrArguments[SYSLOG_MESSAGE]) > 0 ) - OutputDebugMessage("Unparseable Winsyslog message - '" . $arrArguments[SYSLOG_MESSAGE] . "'"); + OutputDebugMessage("Unparseable Winsyslog message - '" . $arrArguments[SYSLOG_MESSAGE] . "'", DEBUG_ERROR); } // If SyslogTag is set, we check for MessageType! diff --git a/src/include/config.sample.php b/src/include/config.sample.php index 4de4764..7fb20f2 100644 --- a/src/include/config.sample.php +++ b/src/include/config.sample.php @@ -54,6 +54,7 @@ $CFG['UserDBLoginRequired'] = false; // --- Misc Options $CFG['MiscShowDebugMsg'] = 0; // if enabled, you will get additional output on certain places +$CFG['MiscDebugToSyslog'] = 0; // if enabled, debug messages from phpLogCon will be send to syslog on linux, and into the EventLog on Windows $CFG['MiscShowDebugGridCounter'] = 0; // Only for debugging purposes, will add a counter column into the grid! $CFG["MiscShowPageRenderStats"] = 1; // If enabled, you will see Pagerender Settings $CFG['MiscEnableGzipCompression'] = 1; // If enabled, phplogcon will use gzip compression for output, we recommend diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 415e6e7..d9c23da 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -388,6 +388,10 @@ function CheckAndSetRunMode() // Obtain max_execution_time $MaxExecutionTime = ini_get("max_execution_time"); + + // Define and Inits Syslog variables now! + define_syslog_variables(); + openlog("phpLogCon", LOG_PID, LOG_USER); // --- Check necessary PHP Extensions! $loadedExtensions = get_loaded_extensions(); @@ -402,7 +406,7 @@ function CheckAndSetRunMode() if ( in_array("mysql", $loadedExtensions) ) { $content['MYSQL_IS_ENABLED'] = true; } else { $content['MYSQL_IS_ENABLED'] = false; } // Check PDO Extension if ( in_array("PDO", $loadedExtensions) ) { $content['PDO_IS_ENABLED'] = true; } else { $content['PDO_IS_ENABLED'] = false; } - + // --- } function InitRuntimeInformations() @@ -878,7 +882,7 @@ function GetEventTime($szTimStr) $eventtime[EVTIME_MICROSECONDS] = 0; // Print Error! - OutputDebugMessage("GetEventTime got an unparsable time '" . $szTimStr . "', returning 0"); + OutputDebugMessage("GetEventTime got an unparsable time '" . $szTimStr . "', returning 0", DEBUG_WARN); } // return result! @@ -1101,7 +1105,6 @@ function SaveGeneralSettingsIntoDB() WriteConfigValue( "MiscShowDebugGridCounter", true ); WriteConfigValue( "MiscShowPageRenderStats", true ); WriteConfigValue( "MiscEnableGzipCompression", true ); - WriteConfigValue( "DebugUserLogin", true ); WriteConfigValue( "SuppressDuplicatedMessages", true ); WriteConfigValue( "ViewMessageCharacterLimit", true ); @@ -1115,6 +1118,10 @@ function SaveGeneralSettingsIntoDB() // Extra Fields WriteConfigValue( "DefaultViewsID", true ); WriteConfigValue( "DefaultSourceID", true ); + + // GLOBAL ONLY + WriteConfigValue( "DebugUserLogin", true ); + WriteConfigValue( "MiscDebugToSyslog", true ); } function SaveUserGeneralSettingsIntoDB() diff --git a/src/include/functions_filters.php b/src/include/functions_filters.php index 810b2dd..b2c4332 100644 --- a/src/include/functions_filters.php +++ b/src/include/functions_filters.php @@ -262,7 +262,7 @@ function GetTimeStampFromTimeString($szTimeString) } else { - OutputDebugMessage("Unparseable Time in GetTimeStampFromTimeString - '" . $szTimeString . "'"); + OutputDebugMessage("Unparseable Time in GetTimeStampFromTimeString - '" . $szTimeString . "'", DEBUG_WARN); return $szTimeString; } } diff --git a/src/include/functions_frontendhelpers.php b/src/include/functions_frontendhelpers.php index e357369..f288124 100644 --- a/src/include/functions_frontendhelpers.php +++ b/src/include/functions_frontendhelpers.php @@ -232,8 +232,9 @@ function GetFormatedDate($evttimearray) return $szDateFormatted = date("Y-m-d H:i:s", $evttimearray[EVTIME_TIMESTAMP] ); } -function OutputDebugMessage($szDbg) +function OutputDebugMessage($szDbg, $szDbgLevel = DEBUG_INFO) { + // Check if we should print the Error! if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 ) { print("
" . $szDbg . " | "); print("