logging in omniORB for python

B

Birgit Rahm

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

f

Birgit said:
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
 
D

Diez B. Roggisch

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

Birgit Rahm

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
 
D

Duncan Grisby

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:[/QUOTE]

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

Cheers,

Duncan.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top