SysLogHandler is drivin me nuts

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • michael

    #1

    SysLogHandler is drivin me nuts

    Hi there,

    I am stuck while trying to use the logging facilities. Its not logging
    :-) Can somebody point me to a solution ?

    The following snipplets are used

    -------------------------------------------
    "crap.py"

    logging.config. fileConfig("log ging.cfg")
    logger = logging.getLogg er ("syslog")
    logger.info('Wh ile this is just chatty')

    -------------------------------------------
    "logging.cf g"

    [syslog]
    class=handlers. SysLogHandler
    level=ERROR
    formatters=form 01
    facility=LOG_LO CAL0
    priority = LOG_INFO

    [formatters]
    keys=form01

    [formatter_form0 1]
    format=%(leveln ame)s %(message)s

    -------------------------------------------
    "/etc/syslog.conf"

    local0.*;local0 .!=debug /var/log/local.log
    local0.=debug /var/log/local-d.log

    Kind regards

    Michael
  • roderik

    #2
    Re: SysLogHandler is drivin me nuts

    michael wrote:[color=blue]
    > Hi there,
    >
    > I am stuck while trying to use the logging facilities. Its not logging
    > :-) Can somebody point me to a solution ?
    >
    > The following snipplets are used
    >
    > -------------------------------------------
    > "crap.py"
    >
    > logging.config. fileConfig("log ging.cfg")
    > logger = logging.getLogg er ("syslog")
    > logger.info('Wh ile this is just chatty')
    >
    > -------------------------------------------
    > "logging.cf g"
    >
    > [syslog]
    > class=handlers. SysLogHandler
    > level=ERROR
    > formatters=form 01
    > facility=LOG_LO CAL0
    > priority = LOG_INFO
    >
    > [formatters]
    > keys=form01
    >
    > [formatter_form0 1]
    > format=%(leveln ame)s %(message)s
    >
    > -------------------------------------------
    > "/etc/syslog.conf"
    >
    > local0.*;local0 .!=debug /var/log/local.log
    > local0.=debug /var/log/local-d.log
    >
    > Kind regards
    >
    > Michael[/color]

    I'm taking a wild guess here(io. I haven't tested your code), but I
    don't think you can expect a logger of level ERROR to logg messages of
    level INFO. Try setting your log level to INFO.

    regards
    /rune

    Comment

    • Vinay Sajip

      #3
      Re: SysLogHandler is drivin me nuts

      michael wrote:[color=blue]
      > Hi there,
      >
      > I am stuck while trying to use the logging facilities. Its not logging
      > :-) Can somebody point me to a solution ?
      >
      > The following snipplets are used
      >
      > -------------------------------------------
      > "crap.py"
      >
      > logging.config. fileConfig("log ging.cfg")
      > logger = logging.getLogg er ("syslog")
      > logger.info('Wh ile this is just chatty')
      >
      > -------------------------------------------
      > "logging.cf g"
      >
      > [syslog]
      > class=handlers. SysLogHandler
      > level=ERROR
      > formatters=form 01
      > facility=LOG_LO CAL0
      > priority = LOG_INFO
      >
      > [formatters]
      > keys=form01
      >
      > [formatter_form0 1]
      > format=%(leveln ame)s %(message)s
      >
      > -------------------------------------------
      > "/etc/syslog.conf"
      >
      > local0.*;local0 .!=debug /var/log/local.log
      > local0.=debug /var/log/local-d.log
      >[/color]

      The config file appears incomplete - can you post the whole of it (if
      it's not too big)? I would have expected to see lines like

      [loggers]
      keys=root

      [handlers]
      keys=syslog

      [logger_root]
      level=DEBUG
      qualname=(root)
      handlers=syslog

      [handler_syslog]
      class=handlers. SysLogHandler
      level=ERROR
      formatter=form0 1
      host=localhost
      port=handlers.S YSLOG_UDP_PORT
      facility=LOG_LO CAL0
      args=(('localho st', handlers.SYSLOG _UDP_PORT),
      handlers.SysLog Handler.LOG_LOC AL0)

      (the args line may wrap in this mail)

      You can't encode the priority in the config file - it is automatically
      determined from the logging level (e.g. INFO -> LOG_INFO).

      Note that the SysLogHandler communicates with the syslog daemon via UDP
      and there may be network problems preventing the messages getting to the
      server. If in doubt, format a UDP packet and send directly from a Python
      script (i.e. not via logging) to confirm that there is no network problem.

      Best regards,


      Vinay Sajip

      Comment

      • michael

        #4
        Re: SysLogHandler is drivin me nuts PEBCAC

        Vinay Sajip <vinay_sajip@re d-dove.com> wrote in message news:<mailman.6 782.1101394046. 5135.python-list@python.org >...[color=blue]
        > The config file appears incomplete - can you post the whole of it (if
        > it's not too big)? I would have expected to see lines like[/color]

        Yep it was incomplete heres the complete config as it has to be

        [loggers]
        keys=root,syslo g

        [handlers]
        keys=syslog,fil e,stdout

        [logger_syslog]
        qualname=syslog
        level=INFO
        handlers=syslog

        [logger_root]
        qualname=root
        level=INFO
        handlers=stdout

        [handler_syslog]
        class=handlers. SysLogHandler
        level=ERROR
        formatter=syslo g
        args=(('localho st', handlers.SYSLOG _UDP_PORT), handlers.SysLog Handler.LOG_USE R)

        [handler_stdout]
        class=StreamHan dler
        level=INFO
        formatter=stdou t
        args=(sys.stdou t,)

        [handler_file]
        class=FileHandl er
        level=INFO
        formatter=stdou t
        args=('python.l og', 'w')

        [formatters]
        keys=syslog,std out

        [formatter_syslo g]
        format=%(module )s %(levelname)s %(message)s

        [formatter_stdou t]
        format=%(module )s %(asctime)s %(levelname)s %(message)s

        Thanks for the help

        Michael

        Comment

        • Vinay Sajip

          #5
          Re: SysLogHandler is drivin me nuts PEBCAC

          michael wrote:[color=blue]
          > Yep it was incomplete heres the complete config as it has to be
          >[/color]
          [config file snipped]

          The complete file looks OK. Did you take into account the comment
          roderik made (about levels - does it work if you set the logger and
          handler levels both to DEBUG)? And have you checked that there is no
          network problem?

          Best regards,

          Vinay Sajip

          Comment

          • michael

            #6
            Re: SysLogHandler is drivin me nuts PEBCAC

            Vinay Sajip <vinay_sajip@re d-dove.com> wrote in message news:<mailman.6 821.1101494250. 5135.python-list@python.org >...[color=blue]
            > michael wrote:[color=green]
            > > Yep it was incomplete heres the complete config as it has to be
            > >[/color]
            > [config file snipped]
            >
            > The complete file looks OK.[/color]

            Thx. with this file it is working. The syslogd configuration under AIX was buggy.

            regards

            Michael

            Comment

            • Jan Dries

              #7
              [OT] Re: SysLogHandler is drivin me nuts PEBCAC

              Slightly OT, but regarding the title, shouldn't it be PEBKAC, since it's
              keyboard and not ceyboard?

              Regards,
              Jan


              michael wrote:
              [color=blue]
              > Vinay Sajip <vinay_sajip@re d-dove.com> wrote in message news:<mailman.6 821.1101494250. 5135.python-list@python.org >...
              >[color=green]
              >>michael wrote:
              >>[color=darkred]
              >>>Yep it was incomplete heres the complete config as it has to be
              >>>[/color]
              >>
              >>[config file snipped]
              >>
              >>The complete file looks OK.[/color]
              >
              >
              > Thx. with this file it is working. The syslogd configuration under AIX was buggy.
              >
              > regards
              >
              > Michael[/color]

              Comment

              • Lloyd Zusman

                #8
                Re: [OT] Re: SysLogHandler is drivin me nuts PEBCAC

                Jan Dries <jan.dries@dcub e-resource.be> writes:
                [color=blue]
                > Slightly OT, but regarding the title, shouldn't it be PEBKAC, since it's
                > keyboard and not ceyboard?[/color]

                Your computer didn't come with a ceyboard? :)

                --
                Lloyd Zusman
                ljz@asfast.com
                God bless you.

                Comment

                • Vinay Sajip

                  #9
                  Re: [OT] Re: SysLogHandler is drivin me nuts PEBCAC

                  Jan Dries <jan.dries@dcub e-resource.be> wrote in message news:<mailman.6 878.1101748438. 5135.python-list@python.org >...[color=blue]
                  > Slightly OT, but regarding the title, shouldn't it be PEBKAC, since it's
                  > keyboard and not ceyboard?
                  >[/color]

                  PEBCAC: Problem Exists Between Chair And Computer

                  Comment

                  • Jan Dries

                    #10
                    Re: [OT] Re: SysLogHandler is drivin me nuts PEBCAC

                    [Jan Dries][color=blue]
                    > Slightly OT, but regarding the title, shouldn't it be PEBKAC,
                    > since it's
                    > keyboard and not ceyboard?[/color]

                    [Vinay Sajip][color=blue]
                    > PEBCAC: Problem Exists Between Chair And Computer[/color]

                    Interesting. I thought it was "Problem Exists Between Keyboard And Chair".
                    But this makes sensee too, of course. Nonetheless, Google has about 17000
                    references for PEBKAC, and only 381 for PEBCAC.

                    Regards,
                    Jan


                    Comment

                    Working...