Development

#3455 ([patch] Can't log debug level in symfony 1.1)

You must first sign up to be able to contribute.

Ticket #3455 (closed defect: fixed)

Opened 8 months ago

Last modified 8 months ago

[patch] Can't log debug level in symfony 1.1

Reported by: snowkrash Assigned to: fabien
Priority: minor Milestone: 1.1.0 RC2
Component: logging Version: 1.1.0 BETA4
Keywords: log symfony 1.1 beta 3 4 debug Cc:
Qualification: Unreviewed

Description

Hi,

The below is also a forum topic (http://www.symfony-project.org/forum/index.php?t=rview&goto=51248&th=12762#msg_51248), but it feels like a bug to me. Just to be sure I created a ticket. If I did something wrong, I apologize for the false ticket.

If I do in Symfony 1.1 beta 3 and 4:

sfContext::getInstance()->getLogger()->log('Log level: '.sfContext::getInstance()->getLogger()->getLogLevel(), 6);

I get in the log:

Log level: 7

But if I pass 7 (debug) instead of 6 (info) to the log() method as display level, nothing is written to the log. Why is that? Of course the result is the same with the info() and debug() methods of sfLogger. Using the latter displays nothing, info() does.

So the loglevel seems to be info, however, getLogLevel() displays 7, which means debug.

What's wrong .... anyone?

factories.yml

  logger:
    class: sfAggregateLogger
    param:
      level: debug
      loggers:
        sf_web_debug:
          class: sfWebDebugLogger
          param:
            condition:      %SF_WEB_DEBUG%
            xdebug_logging: true
        sf_file_debug:
          class: sfFileLogger
          param:
            file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log

settings.yml

dev:
  .settings:
    error_reporting:        <?php echo (E_ALL | E_STRICT)."\n" ?>
    web_debug:              on
    cache:                  off
    no_script_name:         off
    etag:                   off
    logging_enabled:        on

Attachments

log_level_debug.diff (2.9 kB) - added by lathspell on 05/10/08 21:15:06.
Patch for svn trunk

Change History

05/10/08 21:14:38 changed by lathspell

The bug is caused by the "level: debug" being part of the sfAggregateLogger parameters and not part of the individual sf_web_debug and sf_file_debug loggers.

The sfAggregateLogger will pass any log message to any of its child loggers, it does not do any filtering in its doLog().

IMHO this is just a bug in the default yml files and not in the code as it makes absolutely sense to have different loggers of which some only act on certain log levels. Strange though that I the sfAggregateLogger is exposed to the user in the yml config file in the first place, I would have made it default so that one can just add loggers under the "dev:\n logger:\n" line...

bye,

-christian-

05/10/08 21:15:06 changed by lathspell

  • attachment log_level_debug.diff added.

Patch for svn trunk

05/10/08 21:15:47 changed by lathspell

  • summary changed from Can't log debug level in symfony 1.1 to [patch] Can't log debug level in symfony 1.1.

05/11/08 16:54:34 changed by snowkrash

I just tested it .... that change works! :-)

05/11/08 21:28:11 changed by fabien

  • milestone changed from 1.1.0 to 1.1.0 RC2.

05/26/08 19:49:13 changed by Carl.Vondrick

  • status changed from new to closed.
  • resolution set to fixed.

(In [9285]) 1.1: fixed default log level (fixes #3455)