From 0ad27c384033977c86427011785d0182af91df4a Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 23 Apr 2009 14:12:42 -0400
Subject: [PATCH] - Added log_date_format option (#1485709)
---
CHANGELOG | 1 +
program/include/main.inc | 9 +++++----
program/include/bugs.inc | 5 ++++-
config/main.inc.php.dist | 4 ++++
4 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 5e9683c..90b5eb6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
+- Added log_date_format option (#1485709)
- Fix text wrapping in HTML editor after switching from plain text to HTML (#1485521)
- Fix auto-complete function hangs with plus sign (#1485815)
- Fix AJAX requests errors handler (#1485000)
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index 9e3a25e..8bb68cb 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -21,6 +21,10 @@
// log driver: 'syslog' or 'file'.
$rcmail_config['log_driver'] = 'file';
+// date format for log entries
+// (read http://php.net/manual/en/function.date.php for all format characters)
+$rcmail_config['log_date_format'] = 'd-M-Y H:i:s O';
+
// Syslog ident string to use, if using the 'syslog' log driver.
$rcmail_config['syslog_id'] = 'roundcube';
diff --git a/program/include/bugs.inc b/program/include/bugs.inc
index 869022b..c5dac1e 100644
--- a/program/include/bugs.inc
+++ b/program/include/bugs.inc
@@ -69,12 +69,15 @@
global $CONFIG;
$program = strtoupper($arg_arr['type']);
+ if (empty($CONFIG['log_date_format']))
+ $CONFIG['log_date_format'] = '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['log_date_format']),
$program,
$arg_arr['message'],
$arg_arr['file'] ? sprintf(' in %s on line %d', $arg_arr['file'], $arg_arr['line']) : '',
diff --git a/program/include/main.inc b/program/include/main.inc
index b3d0dab..1149429 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -862,10 +862,11 @@
if (!is_string($line))
$line = var_export($line, true);
-
- $log_entry = sprintf("[%s]: %s\n",
- date("d-M-Y H:i:s O", mktime()),
- $line);
+
+ if (empty($CONFIG['log_date_format']))
+ $CONFIG['log_date_format'] = 'd-M-Y H:i:s O';
+
+ $log_entry = sprintf("[%s]: %s\n", date($CONFIG['log_date_format']), $line);
if ($CONFIG['log_driver'] == 'syslog') {
if ($name == 'errors')
--
Gitblit v1.9.1