logging in omniORB for python

Discussion in 'Python' started by Birgit Rahm, Dec 15, 2004.

  1. Birgit Rahm

    Birgit Rahm Guest

    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
    Birgit Rahm, Dec 15, 2004
    #1
    1. Advertising

  2. Birgit Rahm

    f Guest

    Birgit Rahm wrote:
    > Hello newsgroup,


    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(method):
    logger = logging.getLogger('mylogger')
    def _loggedmethod(self, *args, **kw):
    logger.debug('## %s was called ##' % method.func_name)
    return method(self, *args, **kw)
    return _loggedmethod

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

    foo = loggedmethod(foo)

    if __name__ == '__main__':
    logger = logging.getLogger("mylogger")
    logger.addHandler(logging.StreamHandler())
    logger.setLevel(logging.DEBUG)
    a = A()
    print a.foo()




    when running :

    bash-2.05b$ python plop.py
    ## foo was called ##
    foo
    f, Dec 15, 2004
    #2
    1. Advertising

  3. > 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.


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

    omniORB: ObjRef(IDL:ehotel.de/omphalos/Domain:1.0) -- deleted.
    omniORB: inputMessage: from giop:tcp:192.168.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 getTransactionCo
    6e74 6578 7400 4c3a 0000 0000 ntext.L:....

    So check out what happens to you stdout.

    --
    Regards,

    Diez B. Roggisch
    Diez B. Roggisch, Dec 15, 2004
    #3
  4. Birgit Rahm

    Birgit Rahm Guest

    >
    > it gets written to stdout - and then looks like this:
    >
    > omniORB: ObjRef(IDL:ehotel.de/omphalos/Domain:1.0) -- deleted.


    It was tricky: PythonWin doesnt display this, only the output of the
    program.
    Now I have started it in the DOS Box (startPrg.py >logout.log) and the
    omniORB uses the DOS Box to display the messages and the output of the prg
    (in Pythonwin shown in the log window) was logged.
    OK, I see ORB is displaying the expected tracelevel, now I only must
    redirekt it.

    Thanks to all wh helped me.
    Birgit
    Birgit Rahm, Dec 16, 2004
    #4
  5. In article <cpp5ge$5rd$00$-online.com>,
    Diez B. Roggisch <> wrote:

    >> 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.

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


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

    Cheers,

    Duncan.

    --
    -- Duncan Grisby --
    -- --
    -- http://www.grisby.org --
    Duncan Grisby, Dec 17, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Duncan Grisby

    omniORB 4.0.2 and omniORBpy 2.2 released

    Duncan Grisby, Aug 8, 2003, in forum: Python
    Replies:
    3
    Views:
    316
    Duncan Grisby
    Aug 18, 2003
  2. Duncan Grisby

    omniORB 4.0.3 and omniORBpy 2.3 available

    Duncan Grisby, Nov 25, 2003, in forum: Python
    Replies:
    4
    Views:
    379
    Duncan Grisby
    Dec 1, 2003
  3. Melissa Wallis

    omniorb, python and callbacks

    Melissa Wallis, Apr 26, 2004, in forum: Python
    Replies:
    1
    Views:
    409
    Duncan Grisby
    Apr 28, 2004
  4. Birgit Rahm

    (omniorb) Corba using with python

    Birgit Rahm, Nov 4, 2004, in forum: Python
    Replies:
    1
    Views:
    754
    Diez B. Roggisch
    Nov 4, 2004
  5. Jeff Frontz
    Replies:
    0
    Views:
    192
    Jeff Frontz
    Jan 18, 2012
Loading...

Share This Page