Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory
Commits
ebdbe5c5
Unverified
Commit
ebdbe5c5
authored
5 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
feat(core) Add possibility to log debug output
issue
#6065
parent
03bfeb94
dev
6342-update-the-locales-for-1-5
6344-template-issue-when-creating-a-template-with-empty-password-error-message-should-not-be-seen
6365-core-locking-mechanism-is-not-changing-the-mail-ressource-it-does-lock-the-mail-account
6365-core-when-lock-mechanism-is-trigger-the-user-should-not-be-editable-if-not-unlock
6378-orcid-test-method-is-wrong-and-break-orcid-saving
core-php8
master
fusiondirectory-1.5
fusiondirectory-1.4
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
contrib/openldap/core-fd-conf.schema
+7
-1
contrib/openldap/core-fd-conf.schema
include/class_logging.inc
+60
-0
include/class_logging.inc
include/functions.inc
+1
-28
include/functions.inc
plugins/config/class_configInLdap.inc
+5
-0
plugins/config/class_configInLdap.inc
with
73 additions
and
29 deletions
+73
-29
contrib/openldap/core-fd-conf.schema
+
7
−
1
View file @
ebdbe5c5
...
...
@@ -334,6 +334,12 @@ attributetype ( 1.3.6.1.4.1.38414.8.16.4 NAME 'fdDebugLevel'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.38414.8.16.5 NAME 'fdDebugLogging'
DESC 'FusionDirectory - Debug logging'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
# Snapshots
attributetype ( 1.3.6.1.4.1.38414.8.17.1 NAME 'fdEnableSnapshots'
...
...
@@ -599,7 +605,7 @@ objectclass ( 1.3.6.1.4.1.38414.8.2.1 NAME 'fusionDirectoryConf'
fdModificationDetectionAttribute $ fdLogging $ fdLdapSizeLimit $ fdWildcardForeignKeys $
fdLoginAttribute $ fdForceSSL $ fdWarnSSL $ fdStoreFilterSettings $ fdSessionLifeTime $
fdHttpAuthActivated $ fdHttpHeaderAuthActivated $ fdHttpHeaderAuthHeaderName $
fdDisplayErrors $ fdLdapMaxQueryTime $ fdLdapStats $ fdDebugLevel $
fdDisplayErrors $ fdLdapMaxQueryTime $ fdLdapStats $ fdDebugLevel $
fdDebugLogging $
fdEnableSnapshots $ fdSnapshotBase $
fdTabHook $ fdShells $ fdDefaultShell $ fdDisplayHookOutput $
fdPluginsMenuBlacklist $ fdManagementConfig $ fdManagementUserConfig $
...
...
This diff is collapsed.
Click to expand it.
include/class_logging.inc
+
60
−
0
View file @
ebdbe5c5
...
...
@@ -88,6 +88,66 @@ class logging
}
}
/*!
* \brief Debug output method
*
* Print a DEBUG level if specified debug level of the level matches the
* the configured debug level.
*
* \param int $level The log level of the message (one of the DEBUG_* constants)
*
* \param int $line Line of origin (using __LINE__ is common)
*
* \param string $function Function of origin (using __FUNCTION__ is common)
*
* \param string $file File of origin (using __FILE__ is common)
*
* \param mixed $data Operation result. Can be a message or an array, which is printed with print_a.
*
* \param string $info Operation description
*/
static
function
debug
(
int
$level
,
int
$line
,
string
$function
,
string
$file
,
$data
,
string
$info
=
''
)
{
global
$config
;
static
$first
=
TRUE
;
if
((
$_SERVER
[
'REQUEST_METHOD'
]
==
'POST'
)
&&
preg_match
(
'/index.php$/'
,
$_SERVER
[
'REQUEST_URI'
]))
{
return
;
}
if
(
session
::
get
(
'DEBUGLEVEL'
)
&
$level
)
{
if
(
$first
)
{
echo
'<div id="debug-handling" class="notice">'
.
'<img src="geticon.php?context=status&icon=dialog-information&size=22" alt="Information" style="vertical-align:middle;margin-right:.2em;"/>'
.
'There is some debug output '
.
'<button onClick="javascript:$$(\'div.debug_div\').each(function (a) { a.toggle(); });">Toggle</button>'
.
'</div>'
;
$first
=
FALSE
;
}
$output
=
"DEBUG[
$level
] "
;
if
(
$function
!=
''
)
{
$output
.
=
"(
$file
:
$function
():
$line
) -
$info
: "
;
}
else
{
$output
.
=
"(
$file
:
$line
) -
$info
: "
;
}
echo
'<div class="debug_div">'
;
echo
$output
;
$logline
=
$output
;
if
(
is_array
(
$data
))
{
print_a
(
$data
);
$logline
.
=
print_r
(
$data
,
TRUE
);
}
else
{
echo
"'
$data
'"
;
$logline
.
=
"'
$data
'"
;
}
echo
"</div>
\n
"
;
if
(
is_object
(
$config
)
&&
preg_match
(
'/true/i'
,
$config
->
get_cfg_value
(
'debugLogging'
,
''
)))
{
fusiondirectory_log
(
$logline
);
}
}
}
/*!
* \brief Check the options
*
...
...
This diff is collapsed.
Click to expand it.
include/functions.inc
+
1
−
28
View file @
ebdbe5c5
...
...
@@ -172,34 +172,7 @@ function plugin_available ($plugin)
*/
function
DEBUG
(
$level
,
$line
,
$function
,
$file
,
$data
,
$info
=
''
)
{
static
$first
=
TRUE
;
if
((
$_SERVER
[
'REQUEST_METHOD'
]
==
'POST'
)
&&
preg_match
(
'/index.php$/'
,
$_SERVER
[
'REQUEST_URI'
]))
{
return
;
}
if
(
session
::
get
(
'DEBUGLEVEL'
)
&
$level
)
{
if
(
$first
)
{
echo
'<div id="debug-handling" class="notice">'
.
'<img src="geticon.php?context=status&icon=dialog-information&size=22" alt="Information" style="vertical-align:middle;margin-right:.2em;"/>'
.
'There is some debug output '
.
'<button onClick="javascript:$$(\'div.debug_div\').each(function (a) { a.toggle(); });">Toggle</button>'
.
'</div>'
;
$first
=
FALSE
;
}
$output
=
"DEBUG[
$level
] "
;
if
(
$function
!=
''
)
{
$output
.
=
"(
$file
:
$function
():
$line
) -
$info
: "
;
}
else
{
$output
.
=
"(
$file
:
$line
) -
$info
: "
;
}
echo
'<div class="debug_div">'
;
echo
$output
;
if
(
is_array
(
$data
))
{
print_a
(
$data
);
}
else
{
echo
"'
$data
'"
;
}
echo
"</div>
\n
"
;
}
logging
::
debug
(
$level
,
$line
,
$function
,
$file
,
$data
,
$info
);
}
/*!
...
...
This diff is collapsed.
Click to expand it.
plugins/config/class_configInLdap.inc
+
5
−
0
View file @
ebdbe5c5
...
...
@@ -323,6 +323,11 @@ class configInLdap extends simplePlugin
'SESSION'
,
'ACL'
,
'SI'
,
'Mail'
]
)
),
new
BooleanAttribute
(
_
(
'Log debug messages'
),
_
(
'Sends debug output to syslog as well'
),
'fdDebugLogging'
),
]
],
'miscellaneous'
=>
[
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets