Skip to content

Commit

Permalink
More logging adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsnopek committed Feb 6, 2007
1 parent f68a96c commit c4ff548
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
1 change: 1 addition & 0 deletions .bzrignore
Expand Up @@ -4,3 +4,4 @@ inc
MANIFEST MANIFEST
META.yml META.yml
Makefile.old Makefile.old
MANIFEST.bak
28 changes: 12 additions & 16 deletions lib/POE/Component/MessageQueue.pm
Expand Up @@ -128,7 +128,7 @@ sub remove_client
my $self = shift; my $self = shift;
my $client_id = shift; my $client_id = shift;


$self->_log( "MASTER: Removing client $client_id" ); $self->_log( 'notice', "MASTER: Removing client $client_id" );


my $client = $self->get_client( $client_id ); my $client = $self->get_client( $client_id );


Expand Down Expand Up @@ -226,7 +226,7 @@ sub _dispatch_from_store
} }
else else
{ {
$self->_log( "No message in backstore on $destination for $client_id" ); $self->_log( 'notice', "No message in backstore on $destination for $client_id" );


# We need to free up the subscription. # We need to free up the subscription.
my $sub = $queue->get_subscription($client); my $sub = $queue->get_subscription($client);
Expand Down Expand Up @@ -275,7 +275,7 @@ sub route_frame


if ( $frame->command eq 'CONNECT' ) if ( $frame->command eq 'CONNECT' )
{ {
$self->_log( $self->_log( 'notice',
sprintf ("RECV (%i): CONNECT %s:%s", sprintf ("RECV (%i): CONNECT %s:%s",
$client->{client_id}, $client->{client_id},
$frame->headers->{login}, $frame->headers->{login},
Expand All @@ -290,7 +290,7 @@ sub route_frame
} }
elsif ( $frame->command eq 'DISCONNECT' ) elsif ( $frame->command eq 'DISCONNECT' )
{ {
$self->_log( sprintf("RECV (%i): DISCONNECT", $client->{client_id}) ); $self->_log( 'notice', sprintf("RECV (%i): DISCONNECT", $client->{client_id}) );


# disconnect, yo! # disconnect, yo!
$self->remove_client( $client->{client_id} ); $self->remove_client( $client->{client_id} );
Expand All @@ -300,7 +300,7 @@ sub route_frame
my $destination = $frame->headers->{destination}; my $destination = $frame->headers->{destination};
my $persistent = $frame->headers->{persistent} eq 'true'; my $persistent = $frame->headers->{persistent} eq 'true';


$self->_log( $self->_log( 'notice',
sprintf ("RECV (%i): SEND message (%i bytes) to %s (persistent: %i)", sprintf ("RECV (%i): SEND message (%i bytes) to %s (persistent: %i)",
$client->{client_id}, $client->{client_id},
length $frame->body, length $frame->body,
Expand Down Expand Up @@ -332,7 +332,7 @@ sub route_frame
my $destination = $frame->headers->{destination}; my $destination = $frame->headers->{destination};
my $ack_type = $frame->headers->{ack} || 'auto'; my $ack_type = $frame->headers->{ack} || 'auto';


$self->_log( $self->_log( 'notice',
sprintf ("RECV (%i): SUBSCRIBE %s (ack: %s)", sprintf ("RECV (%i): SUBSCRIBE %s (ack: %s)",
$client->{client_id}, $client->{client_id},
$destination, $destination,
Expand All @@ -344,7 +344,7 @@ sub route_frame
my $queue_name = $1; my $queue_name = $1;
my $queue = $self->get_queue( $queue_name ); my $queue = $self->get_queue( $queue_name );


$self->_log( "MASTER: Subscribing client $client->{client_id} to $queue_name" ); $self->_log( 'notice', "MASTER: Subscribing client $client->{client_id} to $queue_name" );


$queue->add_subscription( $client, $ack_type ); $queue->add_subscription( $client, $ack_type );
} }
Expand All @@ -353,7 +353,7 @@ sub route_frame
{ {
my $destination = $frame->headers->{destination}; my $destination = $frame->headers->{destination};


$self->_log( $self->_log( 'notice',
sprintf ("RECV (%i): UNSUBSCRIBE %s\n", sprintf ("RECV (%i): UNSUBSCRIBE %s\n",
$client->{client_id}, $client->{client_id},
$destination) $destination)
Expand All @@ -364,7 +364,7 @@ sub route_frame
my $queue_name = $1; my $queue_name = $1;
my $queue = $self->get_queue( $queue_name ); my $queue = $self->get_queue( $queue_name );


$self->_log( "MASTER: UN-subscribing client $client->{client_id} from $queue_name" ); $self->_log( 'notice', "MASTER: UN-subscribing client $client->{client_id} from $queue_name" );


$queue->remove_subscription( $client ); $queue->remove_subscription( $client );
} }
Expand All @@ -373,7 +373,7 @@ sub route_frame
{ {
my $message_id = $frame->headers->{'message-id'}; my $message_id = $frame->headers->{'message-id'};


$self->_log( $self->_log( 'notice',
sprintf ("RECV (%i): ACK - message %i", sprintf ("RECV (%i): ACK - message %i",
$client->{client_id}, $client->{client_id},
$message_id) $message_id)
Expand All @@ -383,7 +383,7 @@ sub route_frame
} }
else else
{ {
$self->_log( "ERROR: Don't know how to handle frame: " . $frame->as_string ); $self->_log( 'error', "ERROR: Don't know how to handle frame: " . $frame->as_string );
} }
} }


Expand Down Expand Up @@ -412,11 +412,7 @@ sub push_unacked_message


$self->{needs_ack}->{$message->{message_id}} = $unacked; $self->{needs_ack}->{$message->{message_id}} = $unacked;


# TODO: looking for potential leak $self->_log( 'notice', "MASTER: message $message->{message_id} needs ACK from client $client->{client_id}" );
my $needs_ack_count = scalar keys %{$self->{needs_ack}};
$self->_log( 'debug', "MASTER: needs_ack_count=$needs_ack_count" );

$self->_log( "MASTER: message $message->{message_id} needs ACK from client $client->{client_id}" );
} }


sub pop_unacked_message sub pop_unacked_message
Expand Down
7 changes: 4 additions & 3 deletions log.conf
@@ -1,10 +1,11 @@


dispatchers = file screen #dispatchers = file screen
dispatchers = file
#dispatchers = screen #dispatchers = screen
#dispatchers = file


file.class = Log::Dispatch::File file.class = Log::Dispatch::File
file.min_level = info #file.min_level = debug
file.min_level = warning
file.filename = /var/log/perl_mq.log file.filename = /var/log/perl_mq.log
file.mode = append file.mode = append
file.format = [%d] [%p] %m file.format = [%d] [%p] %m
Expand Down

0 comments on commit c4ff548

Please sign in to comment.