logging in omniORB for python

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

    #1

    logging in omniORB for python

    Hello newsgroup,

    I work with omniORB for python and I what to log the calls, does anyone in
    this group know how I can do this?
    I use the command to initialize the ORB
    ORB = CORBA.ORB_init( sys.argv + ["-ORBtraceLevel", "40"], CORBA.ORB_ID)
    but I dont get a log file or a message in pythonwin output display about
    anything.
    Does anyone know, were the log data is? And how I can store it in a file?
    By the way I ask also the omniORB mailing list, but here are the python
    experts.

    --

    Mit freundlichen Grüßen / best regards
    Birgit Rahm


  • f

    #2
    Re: logging in omniORB for python

    Birgit Rahm wrote:[color=blue]
    > Hello newsgroup,[/color]

    Hello Birgit,

    I haven't found any way to do logging in a standard way.

    The solution i've implemented is to decorate each method you want to log
    the call, using the logging module (included in python since 2.3)

    For example :

    import logging

    def loggedmethod(me thod):
    logger = logging.getLogg er('mylogger')
    def _loggedmethod(s elf, *args, **kw):
    logger.debug('# # %s was called ##' % method.func_nam e)
    return method(self, *args, **kw)
    return _loggedmethod

    # imagine A is your corba object
    class A:
    def foo(self):
    return 'foo'

    foo = loggedmethod(fo o)

    if __name__ == '__main__':
    logger = logging.getLogg er("mylogger")
    logger.addHandl er(logging.Stre amHandler())
    logger.setLevel (logging.DEBUG)
    a = A()
    print a.foo()




    when running :

    bash-2.05b$ python plop.py
    ## foo was called ##
    foo

    Comment

    • Diez B. Roggisch

      #3
      Re: logging in omniORB for python

      > Does anyone know, were the log data is? And how I can store it in a file?[color=blue]
      > By the way I ask also the omniORB mailing list, but here are the python
      > experts.[/color]

      it gets written to stdout - and then looks like this:

      omniORB: ObjRef(IDL:ehot el.de/omphalos/Domain:1.0) -- deleted.
      omniORB: inputMessage: from giop:tcp:192.16 8.1.3:33465 76 bytes
      omniORB:
      4749 4f50 0102 0100 4000 0000 1400 0000 GIOP....@...... .
      0300 0000 0000 0000 0e00 0000 fe81 18c0 ............... .
      4100 0016 9800 0000 0002 0000 1600 0000 A.............. .
      6765 7454 7261 6e73 6163 7469 6f6e 436f getTransactionC o
      6e74 6578 7400 4c3a 0000 0000 ntext.L:....

      So check out what happens to you stdout.

      --
      Regards,

      Diez B. Roggisch

      Comment

      • Duncan Grisby

        #4
        Re: logging in omniORB for python


        In article <cpp5ge$5rd$00$ 1@news.t-online.com>,
        Diez B. Roggisch <deetsNOSPAM@we b.de> wrote:
        [color=blue][color=green]
        >> Does anyone know, were the log data is? And how I can store it in a file?
        >> By the way I ask also the omniORB mailing list, but here are the python
        >> experts.[/color]
        >
        >it gets written to stdout - and then looks like this:[/color]

        To avoid any confusion, it actually gets written to stderr, not
        stdout.

        Cheers,

        Duncan.

        --
        -- Duncan Grisby --
        -- duncan@grisby.o rg --
        -- http://www.grisby.org --

        Comment

        Working...