Forum OpenACS Q&A: xotcl method 'my log msg' not appearing in log

Can anyone explain to me why when I try to write debugging info to the serverlog using the xotcl method....

my log "Something happened!"

...nothing appears in the log.

However, if I call ns_log notice "Something happened!", then it does.

Given that the source-code for the log method is this:

::xotcl::Object instproc log msg {
ns_log notice "$msg, [self] [self callingclass]->[self callingproc] ([my __timediff])"
}

....I cannot understand why!?!

In this case I am trying to call the log method in a class instproc. Does that have anything to do with it?

As in:

::xotcl::Class create myClass

myClass instproc logTest {
my log "Hello world!"
}

Now when I instantiate myClass and call myClass logTest, absolutely nothing happens! - no errors, no log entry.

Regards
Richard

Collapse
Posted by Gustaf Neumann on
Hi Richard,

the problem is not the method log, but that myClass logTest is indeed a short form for myClass create logTest. The following snippet should work, try it out in your ds/shell...

::xotcl::Class create myClass
myClass instproc logTest {} {
   my log "Hello world!"
}
myClass create c1
c1 logTest
PS: XOTcl's successor NX is safer, it requires per default the explicit usage of the create method.