We've already seen a glimpse of the configuration relating to logging of messages in the previous section. As standard, the Jabber server configuration describes two types of logging record and a recipient file for each type:
- Error logging
Error log records are written to
error.login the current directory, as determined thus:
<log id='elogger'> <host/> <logtype/> <format>%d: [%t] (%h): %s</format> <file>error.log</file> <stderr/> </log>
- Statistical logging
Statistical log records used for tracking purposes are written to
record.login the current directory, as determined thus:
<log id='rlogger'> <host/> <logtype>record</logtype> <format>%d %h %s</format> <file>record.log</file> </log>
Log records of this type are written when a client connects to the server and when a client disconnects.
Furthermore, we can use the debugging switch (-D) when we start the server and have debugging and trace output written to STDERR.
If Your Server Doesn't Start
A number of likely candidates might have prevented your server from starting.
- Bad XML configuration
It is not difficult to make errors (typographical or otherwise) in the server configuration. The first line of defense is to be careful when editing your
jabber.xmlfile. After that, the Jabber server isn't going to be too forthcoming with information if you have broken the well-formedness of the XML:
yak:~/jabber-1.4.1$ ./jabberd/jabberd -h yak Configuration parsing using jabber.xml failed
Help is at hand in the shape of Perl and the
XML::Parsermodule, which is a wrapper around the XML parser,
Providing you have Perl and the
XML::Parsermodule installed, you can get
expatto give you a clue where the XML is broken:
yak:~/jabber-1.4.1$ perl -MXML::Parser -e 'XML::Parser->new->parsefile("jabber.xml", ErrorContext => 3)' not well-formed (invalid token) at line 47, column 35, byte 1750: be on one line, the server doesn't like it otherwise! :) --> <host><jabberd:cmdline flag="h"yak</jabberd:cmdline></host> ==================================^ <!-- This is the custom configuration section for the at /usr/local/lib/perl5/site_perl/5.6.0/i586-linux/XML/Parser.pm line 185 yak:~/jabber-1.4.1$
This shows us exactly where the problcode is. In this case, the close-tag symbol (>) had been inadvertently rcodeoved when replacing
No XML Is Bad XML!
If you don't use the -c switch to specify which configuration file to use, the standard
jabber.xmlis used. If that file can't be found, you get
exactly the same erroras if your XML was not well-formed. You've been warned!
- Unable to listen on port(s)
Taking the standard
jabber.xmlconfiguration, the Jabber server tries to bind to and listen on two ports: 5222 (for client connections) and 5269 (for server-to-server connections). If other processes are listening to these ports, then the Jabber server can't start and you'll see something like this in the
20010407T12:11:06: [alert] (-internal): io_select unable to listen on 5222 [(null)] 20010406T12:11:06: [alert] (-internal): io_select unable to listen on 5269 [(null)]
If this is the case, use the
netstatcommand to check the status of the ports:
yak:~/jabber-1.4.1$ netstat -an | grep -E '5222|5269' tcp 0 0 0.0.0.0:5269 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:5222 0.0.0.0:* LISTEN
If you see entries like this, it means that processes have been bound to these ports on
For example, if
0.0.0.0:5222is being listened to then you may have another instance of a Jabber server already running.
On some BSD systcodes, you cannot bind to the "default" null address; the same error messages will be issued as if the ports were already bound. In the standard
jabber.xmlconfiguration file, a bind to the null address is specified for each port as standard; you must change this and specify an explicit IP address for each of the ports in the configuration. That is, instead of:
do something like this:
In fact, the next patch level version of the Jabber server, 1.4.2, which is available already, has the modifications necessary for it to be compilable under Mac OS X.
If you want the Jabber server to support SSL connections, you will need to have installed an SSL package; see the next chapter for more details.
The "zones" are the filenames that immediately follow the timestamp in the
debug log records, for example,
deliver. Specifying one or
more zones will limit debug output to lines that pertain to those zones.
 Better highlighting of problcodes in parsing the configuration file is available in Version 1.4.2 of the server. You're told where the configuration is broken or if there were problcodes opening the file.
This "all" relates to the
(null) shown in the unable-to-listen
error messages shown earlier.
O'Reilly & Associates recently released (December 2001) Programming Jabber.
Sample Chapter 5, Jabber Technology Basics, is available free online.
For more information, or to order the book, click here.