Managing Document queues

We had a condition today where we need to detect when an Adapter has more than XX documents in the queue. We know that the Broker queues normally clear routinely and when they do not clear then we have a problem.
My intent is to used WebMethods to look into it’s logs (somehow) and then generate a notification event that the Broker queues for a specific Adapter is backed up.
Has anyone done anything like this or could share where to look in the log files for that condition? We have the logger adapter running data to an Oracle 8i database. Our Broker environment is :
Enterprise Server 5.0 sp11, Sun Solaris 8

We have had pretty good luck with the BrokerAdminClient api class. Specifically the getClientStatsById method. It returns several statistics including one named queueLength. The “Administration API Reference for Java” reference guide is where we found out about it.