User Profile

Collapse

Profile Sidebar

Collapse
jool
jool
Last Activity: Dec 18 '06, 04:42 PM
Joined: Nov 29 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • I did setup a handler in a method called LogSetup:
    Code:
    def LogSetup():
        log = logging.getLogger("sitelogs")
        fmt = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
        
        log.setLevel(logging.DEBUG)
        fhnd = logging.FileHandler('logs.log', 'a')
        fhnd.setLevel(logging.DEBUG)
        fhnd.setFormatter(fmt)
        log.addHandler(fhnd)
    My question how...
    See more | Go to post
    Last edited by bartonc; Dec 15 '06, 03:24 AM. Reason: added [code][/code] tags

    Leave a comment:


  • Subprocess: Need Help Sending Errors, and Output to the Log File

    I have this code:
    Code:
    cmd_output =subprocess.Popen([cmd], shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()
                        log.debug(cmd))
    I have a logger defined, and all the logs goes to the file. Now, what I want to do is, log output and error of subprocess to this log_file. Also I can you tell what does it do, when you set stderr=subproce ss.PIPE and stdout=subproce ss.PIPE, and where does the...
    See more | Go to post
    Last edited by bartonc; Dec 15 '06, 01:11 AM. Reason: added code tags

  • jool
    started a topic Python Exception How

    Python Exception How

    I want to create an exception for example:
    Code:
    try: 
       mycode...here
    except  SomeError:
        log.debug("""testing message """,)
    SomeError Class have to be defined or I could just state it as in "except SomeError"?
    See more | Go to post
No activity results to display
Show More
Working...