Bug #48918

FileLogWriter ignores log file configuration

Added by Steffen Müller about 8 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Must have
Category:
Logging
Target version:
-
Start date:
2013-06-06
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If there are several instances of TYPO3\CMS\Core\Log\Writer\FileLogWriter with different log files configured in $logFile, all log records end up in one file.

This is caused by improper use of static variable $logFileHandle. All filehandles except the one of the latest instance are ignored.

#1

Updated by Gerrit Code Review about 8 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21258

#2

Updated by Steffen Müller about 8 years ago

Steps to reproduce

Add some log calls to a file:

$logger = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')->getLogger(__CLASS__);
$logger->error('my-error');
$logger->debug('my-debug');

Configure logging:

$TYPO3_CONF_VARS['LOG']['writerConfiguration'] = array(
  \TYPO3\CMS\Core\Log\LogLevel::ERROR => array(
    'TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter' => array(
      'logFile' => 'typo3temp/logs/error.log'
    ),
  ),
  \TYPO3\CMS\Core\Log\LogLevel::DEBUG => array(
    'TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter' => array(
      'logFile' => 'typo3temp/logs/debug.log'
    ),
  ),
);

Expected result

$ cat typo3temp/logs/debug.log 
Thu, 06 Jun 2013 16:29:20 +0200 [ERROR] request="51b09cbec1156" component="...": my-error 
Thu, 06 Jun 2013 16:29:20 +0200 [DEBUG] request="51b09cbec1156" component="...": my-debug
$ cat typo3temp/logs/error.log 
Thu, 06 Jun 2013 16:29:20 +0200 [ERROR] request="51b09cbec1156" component="...": my-error

Actual result

$ cat typo3temp/logs/debug.log
Thu, 06 Jun 2013 16:25:25 +0200 [ERROR] request="51b09bd4a9c19" component="...": my-error 
Thu, 06 Jun 2013 16:25:25 +0200 [ERROR] request="51b09bd4a9c19" component="...": my-error 
Thu, 06 Jun 2013 16:25:25 +0200 [DEBUG] request="51b09bd4a9c19" component="...": my-debug
$ cat typo3temp/logs/error.log
[EMPTY FILE]
#3

Updated by Gerrit Code Review about 8 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21258

#4

Updated by Gerrit Code Review about 8 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21258

#5

Updated by Gerrit Code Review about 8 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21258

#6

Updated by Gerrit Code Review about 8 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21258

#7

Updated by Gerrit Code Review about 8 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21258

#8

Updated by Gerrit Code Review about 8 years ago

Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/21324

#9

Updated by Gerrit Code Review about 8 years ago

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/21325

#10

Updated by Steffen Müller about 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#11

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF