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 8234803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:36:16+00:00 2026-06-07T18:36:16+00:00

I am trying to switch from simple printing to proper logging. I want to

  • 0

I am trying to switch from simple printing to proper logging.

I want to use two different loggers, the first one displaying information on screen and the other one in a file.

My problem is that even though I set my handler level to DEBUG, messages are only displayed from WARNING.

Here is a sample of my code :

def setup_logger(self):

    """

    Configures our logger to save error messages

    """

    # create logger for  'facemovie'

    self.my_logger = logging.getLogger('FileLog')

    # create file handler which logs even debug messages

    fh = logging.FileHandler('log/fm.log')

    fh.setLevel(logging.DEBUG)

    # create console handler with a higher log level

    self.console_logger = logging.getLogger('ConsoleLog')

    ch = logging.StreamHandler()

    ch.setLevel(logging.DEBUG)



    # create formatter and add it to the handlers

    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

    fh.setFormatter(formatter)

    #ch.setFormatter(formatter)



    ##Start logging in file

    self.my_logger.info("######")



    # add the handlers to the logger

    self.my_logger.addHandler(fh)

    self.console_logger.addHandler(ch)



    # DEBUG

    self.console_logger.info("MFCKR")

    self.console_logger.debug("MFCKR")

    self.console_logger.warning("MFCKR")

    self.console_logger.error("MFCKR")

    self.console_logger.critical("MFCKR")

    self.my_logger.info("MFCKR")

    self.my_logger.debug("MFCKR")

    self.my_logger.warning("MFCKR")

    self.my_logger.error("MFCKR")

    self.my_logger.critical("MFCKR")

And the output :

[jll@jll-VirtualBox:~/Documents/FaceMovie]$ python Facemoviefier.py -i data/inputs/samples -o data/
Selected profile is : frontal_face
MFCKR
MFCKR
MFCKR
Starting Application !
Output #0, avi, to 'data/output.avi':
    Stream #0.0: Video: mpeg4, yuv420p, 652x498, q=2-31, 20780 kb/s, 90k tbn, 5 tbc
FaceMovie exited successfully!
[jll@jll-VirtualBox:~/Documents/FaceMovie]$ cat log/fm.log 
2012-07-15 22:23:24,303 - FileLog - WARNING - MFCKR
2012-07-15 22:23:24,303 - FileLog - ERROR - MFCKR
2012-07-15 22:23:24,303 - FileLog - CRITICAL - MFCKR

I red the doc and searched for similar errors on the web, but couldn’t find any.

Would you have ideas about the reason why the logger doesn’t display DEBUGs and INFOs ?

Thx !

  • 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-06-07T18:36:17+00:00Added an answer on June 7, 2026 at 6:36 pm

    Just found the answer here

    Don’t know why I didn’t find it before.

    The whole logger level has to be set, even though the handler also is.
    I was not setting up the logger’s level, and I guess in this case default is Warning.

    Problem solved !

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

Sidebar

Related Questions

I am trying to have an h:inputText switch out with a different one when
I'm trying to switch from AjaxControlToolkit to jQuery UI tabs for a fairly simple
Im a trying to use pantheios logging framework from inside a c++ dll. I
I'm trying to retrieve a boolean value from one of two member functions. I
I'm trying to make a simple css framework which allows me to switch from
So my problem is simple. I am trying to switch my chart from a
I'm trying to switch from CellTable to DataGrid. The actual change was very easy
I have never code in Python and trying to switch from Javascrpt/SVG. Being confused
I have a Jekyll blog, I am trying to switch from this {:lang='bash'} #!/bin/sh
I'm trying to convince a friend of mine to switch from OCaml to F#,

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.