Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6646167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:23:00+00:00 2026-05-26T00:23:00+00:00

Most of my app logging is done at debug level because in sf 1.4

  • 0

Most of my app logging is done at debug level because in sf 1.4 it’s not used by symfony itself, and that makes it easy to see just the messages I’m interested in using something like:

tail -f log/frontend_dev.php | grep "\[debug\]"

This is great in the dev environment while I’m sat there watching it scroll past, but I now want to log only these debug messages in the production environment.

If I set the log level for the production log to debug, then obviously I’ll get everything down to and including the debug level, which is far too much data.

Is it possible to write a logger that will just record [debug] messages and nothing else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:23:01+00:00Added an answer on May 26, 2026 at 12:23 am

    Of course it is possible – you can extend sfFileLogger and override log($message, $priority) function (which sfFileLogger inherits from sfLogger class).

    ...
    public function log($message, $priority = self::DEBUG)
    {
      if ($this->getLogLevel() != $priority)
      {
        return false;
      }
    
      return $this->doLog($message, $priority);
    }
    ...
    

    Now you have to configure logging in your app to use your new logger class, configuration is located in app/<your app>/config/factories.yml:

    prod:
      logger:
        class:   sfAggregateLogger
        param:
          level:   DEBUG
          loggers:
            sf_file_debug:
              class: myDebugOnlyLoggerClass
              param:
                level: DEBUG
                file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log
    

    This logger will save only messages logged with the same priority (and only the same, not the same or higher) as configured in factories.yml.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Most people would agree that internationalizing an existing app is more expensive than developing
I'm working with a legacy Java app that has no logging and just prints
I have a Django app where most of the search is driven by foreign
What is the most efficient way to port an iPhone app to Android? I
Im using Storyboard for most screens in my iPhone app. However, I have one
An android app I'm working on relies on a web page for most of
My application is running on Google App Engine and most of requests constantly gets
I'm developing a WPF app using MVVM. Most of my views have only xaml
I am currently writing my first Android app and have based most of my
I have an OpenCV Android app. Most of its code is in Java but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.