Opened 4 years ago
Closed 4 years ago
#1485709 closed Feature Patches (fixed)
date_log config variable
| Reported by: | mbac | Owned by: | |
|---|---|---|---|
| Priority: | 8 | Milestone: | 0.3-beta |
| Component: | PHP backend | Version: | git-master |
| Severity: | trivial | Keywords: | log date |
| Cc: |
Description
Customizing the date format for logs/ helps simplify a whole class of administrator maintenance tasks.
Stick in config/main.inc.php:
// use this format for logs/ entries $rcmail_config['date_log'] = 'd-M-Y H:i:s O';
Diffs to add support for date_log
--- /tmp/rc-svn/program/include/bugs.inc 2009-01-26 13:44:28.000000000 -0500
+++ program/include/bugs.inc 2009-01-29 13:42:26.000000000 -0500
@@ -69,12 +69,15 @@
global $CONFIG;
$program = strtoupper($arg_arr['type']);
+ if (empty($CONFIG['date_log']))
+ $CONFIG['date_log'] = 'd-M-Y H:i:s O';
+
// write error to local log file
if ($CONFIG['debug_level'] & 1)
{
$post_query = ($_SERVER['REQUEST_METHOD'] == 'POST' ? '?_task='.urlencode($_POST['_task']).'&_action='.urlencode($_POST['_action']) : '');
$log_entry = sprintf("[%s] %s Error: %s%s (%s %s)\n",
- date("d-M-Y H:i:s O", mktime()),
+ date($CONFIG['date_log'], mktime()),
$program,
$arg_arr['message'],
$arg_arr['file'] ? sprintf(' in %s on line %d', $arg_arr['file'], $arg_arr['line']) : '',
--- /tmp/rc-svn/program/include/main.inc 2009-01-29 13:49:20.000000000 -0500
+++ program/include/main.inc 2009-01-29 13:50:13.000000000 -0500
@@ -850,9 +850,12 @@
if (!is_string($line))
$line = var_export($line, true);
-
+
+ if (empty($CONFIG['date_log']))
+ $CONFIG['date_log'] = 'd-M-Y H:i:s O';
+
$log_entry = sprintf("[%s]: %s\n",
- date("d-M-Y H:i:s O", mktime()),
+ date($CONFIG['date_log'], mktime()),
$line);
if ($CONFIG['log_driver'] == 'syslog') {
Change History (2)
comment:1 Changed 4 years ago by alec
- Component changed from Other to PHP backend
- Milestone changed from later to 0.3-beta
comment:2 Changed 4 years ago by alec
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.

Applied in [0ad27c38] with option name change to 'log_date_format'