Debugging product init with zopectl?
Hi all, I'm new to Zope, getting started with the "minimal" project (http://www.zope.org/Members/maxm/HowTo/minimal_01). For whatever reason, minimal doesn't work out of the box. That would be fine except that when I start Zope with zopectl it reports status as fine and the process runs, but I don't get any logs generated and I can't connect to the server. But, if I use runzope I can see what's wrong and the server dies immediately: File "/var/lib/zope/zope-test/Products/minimal/__init__.py", line 8, in initialize constructors = ( AttributeError: manage_addMinimalForm My concern isn't this error, which I fixed by importing the function explicitly. But why did I have to use runzope to see this? Shouldn't zopectl inform me that the server is completely broken? By the way, I'm using a standard Gentoo installation of Zope, and I haven't changed any options from defaults. Could someone please tell me if this is expected behavior? Should I be using runzope in a screen or something? Thanks, Konrad
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Konrad Rokicki wrote:
Hi all, I'm new to Zope, getting started with the "minimal" project (http://www.zope.org/Members/maxm/HowTo/minimal_01). For whatever reason, minimal doesn't work out of the box. That would be fine except that when I start Zope with zopectl it reports status as fine and the process runs, but I don't get any logs generated and I can't connect to the server.
But, if I use runzope I can see what's wrong and the server dies immediately: File "/var/lib/zope/zope-test/Products/minimal/__init__.py", line 8, in initialize constructors = ( AttributeError: manage_addMinimalForm
My concern isn't this error, which I fixed by importing the function explicitly. But why did I have to use runzope to see this? Shouldn't zopectl inform me that the server is completely broken?
By the way, I'm using a standard Gentoo installation of Zope, and I haven't changed any options from defaults.
Could someone please tell me if this is expected behavior? Should I be using runzope in a screen or something?
In "production mode", Zope will start even if a product fails to import; you should see it complain in the logs in this case. In debug mode, it stops and complains. I usually run 'bin/zopectl fg' to do the testing, which forces debug mode on (at least in recent 2.7.x). Tres Seaver. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCe58G+gerLs4ltQ4RAjn1AJ9p8zcaWLN59hJRtSdAUYdw70IuGgCfdbPG 0z07UAIZAmQ7fvizSnl4pco= =9AXs -----END PGP SIGNATURE-----
Konrad Rokicki wrote:
Hi all, I'm new to Zope, getting started with the "minimal" project (http://www.zope.org/Members/maxm/HowTo/minimal_01). For whatever reason, minimal doesn't work out of the box. That would be fine except that when I start Zope with zopectl it reports status as fine and the process runs, but I don't get any logs generated and I can't connect to the server.
But, if I use runzope I can see what's wrong and the server dies immediately: File "/var/lib/zope/zope-test/Products/minimal/__init__.py", line 8, in initialize constructors = ( AttributeError: manage_addMinimalForm
My concern isn't this error, which I fixed by importing the function explicitly. But why did I have to use runzope to see this? Shouldn't zopectl inform me that the server is completely broken?
By the way, I'm using a standard Gentoo installation of Zope, and I haven't changed any options from defaults.
Could someone please tell me if this is expected behavior? Should I be using runzope in a screen or something?
The 'zopectl' script launches as a daemon, so it has no place to write output to screen. It does write to the log file. Problem is, the logfile isn't usable until after startup, so startup errors cannot be logged. I agree, it would be nice to have zLOG work on startup, but I don't know how easy/possible that is. In debug mode (the default) Zope fails when a Product fails to init. This is useful when running 'runzope' since you don't have to kill Zope. Without debug mode, Zope will start up, but the Product will be broken, and its failure listed in the Products section of the Control Panel. If you suspect Product init failure, you should use runzope. I do, in general, during devlopment of those parts. --jcc -- "Building Websites with Plone" http://plonebook.packtpub.com/
jcc, I apologize for replying directly, here it is again for a list:
Without debug mode, Zope will start up, but the Product will be broken, and its failure listed in the Products section of the Control Panel.
This would be a decent workaround the lack of logging if it worked. My problem is that the server doesn't respond at all after that product init fails. The process keeps running with no logs and I can't connect to it.
If you suspect Product init failure, you should use runzope. I do, in general, during devlopment of those parts.
I will do that then, thanks. -Konrad
On Fri, 2005-05-06 at 12:48, J Cameron Cooper wrote:
I agree, it would be nice to have zLOG work on startup, but I don't know how easy/possible that is.
FWIW, the reason zLOG doesn't start writing to the log at an earlier time is that it waits until the process can switch effective users. If it didn't and Zope started by root (or another user that isn't the desired effective user), some log files might be written as root, and would become unwritable at a second startup (this used to be a FAQ before Zope 2.7 prevented it from happening). Probably some work can be done here to be smarter in cases where this doesn't matter. - C
J Cameron Cooper wrote at 2005-5-6 11:48 -0500:
... I agree, it would be nice to have zLOG work on startup, but I don't know how easy/possible that is.
It would be very easy -- with the exception of people that run Zope as "root" (and later switch the process user). This silly silent logging during startup was only implemented to avoid problems occuring when Zope starts up as root and later switches. Zope could easily start logging as soon as it had read the configuration file and had seen that it is not going to switch users.
In debug mode (the default) Zope fails when a Product fails to init. This is useful when running 'runzope' since you don't have to kill Zope. Without debug mode, Zope will start up, but the Product will be broken, and its failure listed in the Products section of the Control Panel.
But unfortunately, there are errors that are not reported via the product's "Traceback" tab. The only reliable source is the logfile. -- Dieter
participants (5)
-
Chris McDonough -
Dieter Maurer -
J Cameron Cooper -
Konrad Rokicki -
Tres Seaver