Bug 233 - Further debug enhancements

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1688 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2005-12-16 13:16:37 +00:00
parent 1ad2371c8a
commit 7b5cc99c93
16 changed files with 44 additions and 21 deletions

View File

@ -94,8 +94,6 @@ BEGIN
use POSIX;
use Time::HiRes qw/gettimeofday/;
our $dbg_id = "zm";
sub dbgPrint
{
my $code = shift;
@ -109,11 +107,11 @@ sub dbgPrint
{
my $file = __FILE__;
$file =~ s|^.*/||g;
printf( STDERR "%s.%06d %s[%d].%s-%s/%d [%s]\n", strftime( "%x %H:%M:%S", localtime( $seconds ) ), $microseconds, $dbg_id, $$, $file, $line, $code, $string );
printf( STDERR "%s.%06d %s[%d].%s-%s/%d [%s]\n", strftime( "%x %H:%M:%S", localtime( $seconds ) ), $microseconds, main::DBG_ID, $$, $file, $line, $code, $string );
}
else
{
printf( STDERR "%s.%06d %s[%d].%s [%s]\n", strftime( "%x %H:%M:%S", localtime( $seconds ) ), $microseconds, $dbg_id, $$, $code, $string );
printf( STDERR "%s.%06d %s[%d].%s [%s]\n", strftime( "%x %H:%M:%S", localtime( $seconds ) ), $microseconds, main::DBG_ID, $$, $code, $string );
}
}
@ -177,7 +175,7 @@ If you have a web site set up for your module, mention it here.
=head1 AUTHOR
Philip Coombes, E<lt>stan@localdomainE<gt>
Philip Coombes, E<lt>philip.coombes@zoneminder.comE<gt>
=head1 COPYRIGHT AND LICENSE

View File

@ -42,6 +42,7 @@ use constant MIN_AGE => 300; # Minimum age when we will delete anything
use constant RECOVER_TAG => "(r)"; # Tag to append to event name when recovered
use constant RECOVER_TEXT => "Recovered."; # Text to append to event notes when recovered
use constant DBG_ID => "zmaudit"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 1; # 0 is errors, warnings and info only, > 0 for debug
# ==========================================================================

View File

@ -33,6 +33,7 @@ use strict;
#
# ==========================================================================
use constant DBG_ID => "zmctrl-axis"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
# ==========================================================================

View File

@ -33,6 +33,7 @@ use strict;
#
# ==========================================================================
use constant DBG_ID => "zmctrl-pana"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
# ==========================================================================

View File

@ -33,6 +33,7 @@ use strict;
#
# ==========================================================================
use constant DBG_ID => "zmctrl-peld"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
# ==========================================================================

View File

@ -33,6 +33,7 @@ use strict;
#
# ==========================================================================
use constant DBG_ID => "zmctrl-pelp"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
# ==========================================================================

View File

@ -33,6 +33,7 @@ use strict;
#
# ==========================================================================
use constant DBG_ID => "zmctrl-visc"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
# ==========================================================================

View File

@ -36,9 +36,11 @@ use bytes;
#
# ==========================================================================
use constant MAX_CONNECT_DELAY => 10;
use constant DBG_ID => "zmdc"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
use constant MAX_CONNECT_DELAY => 10;
# ==========================================================================
#
# Don't change anything from here on down
@ -334,18 +336,21 @@ if ( !connect( CLIENT, $saddr ) )
my $exit_signal = $status&0xfe;
my $core_dumped = $status&0x01;
my $out_str = "'$process->{daemon} ".join( ' ', @{$process->{args}} )."' ";
$out_str .= ($exit_status==0)?"died":"crashed";
$out_str .= ", exit status $exit_status" if ( $exit_status );
$out_str .= ", signal $exit_signal" if ( $exit_signal );
#print( ", core dumped" ) if ( $core_dumped );
$out_str .= "\n";
if ( $exit_status == 0 )
{
Info( "'$process->{daemon} ".join( ' ', @{$process->{args}} )."' died at ".strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{stopped} ) ) );
Info( $out_str );
}
else
{
Error( "'$process->{daemon} ".join( ' ', @{$process->{args}} )."' crashed at ".strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{stopped} ) ) );
Error( $out_str );
}
print( ", exit status $exit_status" ) if ( $exit_status );
print( ", signal $exit_signal" ) if ( $exit_signal );
#print( ", core dumped" ) if ( $core_dumped );
print( "\n" );
if ( $process->{keepalive} )
{
@ -454,15 +459,16 @@ if ( !connect( CLIENT, $saddr ) )
return();
}
}
dprint( "'$process->{command}' running at ".strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{started}) ).", pid = $process->{pid}" );
dprint( "'$process->{command}' running since ".strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{started}) ).", pid = $process->{pid}" );
}
else
{
foreach my $process ( values(%pid_hash) )
{
dprint( "'$process->{command}' running at ".strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{started}) ).", pid = $process->{pid}" );
dprint( ", valid" ) if ( kill( 0, $process->{pid} ) );
dprint( "\n" );
my $out_str = "'$process->{command}' running since ".strftime( '%y/%m/%d %H:%M:%S', localtime( $process->{started}) ).", pid = $process->{pid}";
$out_str .= ", valid" if ( kill( 0, $process->{pid} ) );
$out_str .= "\n";
dprint( $out_str );
}
foreach my $process ( values( %cmd_hash ) )
{

View File

@ -34,9 +34,11 @@ use bytes;
#
# ==========================================================================
use constant START_DELAY => 5; # How long to wait before starting
use constant DBG_ID => "zmfilter"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
use constant START_DELAY => 5; # How long to wait before starting
# ==========================================================================
#
# You shouldn't need to change anything from here downwards

View File

@ -33,6 +33,7 @@ use bytes;
#
# ==========================================================================
use constant DBG_ID => "zmpkg"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
# ==========================================================================

View File

@ -33,9 +33,11 @@ use bytes;
#
# ==========================================================================
use constant SLEEP_TIME => 10000; # In microseconds
use constant DBG_ID => "zmtrack"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 1; # 0 is errors, warnings and info only, > 0 for debug
use constant SLEEP_TIME => 10000; # In microseconds
# ==========================================================================
#
# Don't change anything from here on down

View File

@ -33,9 +33,11 @@ use bytes;
#
# ==========================================================================
use constant MAX_CONNECT_DELAY => 10;
use constant DBG_ID => "zmtrigger"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
use constant MAX_CONNECT_DELAY => 10;
# Now define the trigger sources, can be inet socket, unix socket or file based
# Ignore parser field for now.

View File

@ -34,9 +34,11 @@ use bytes;
#
# ==========================================================================
use constant CHECK_INTERVAL => (1*24*60*60); # Interval between version checks
use constant DBG_ID => "zmupdate"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
use constant CHECK_INTERVAL => (1*24*60*60); # Interval between version checks
# ==========================================================================
#
# Don't change anything below here

View File

@ -33,6 +33,7 @@ use bytes;
#
# ==========================================================================
use constant DBG_ID => "zmvideo"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
# ==========================================================================

View File

@ -34,9 +34,10 @@ use bytes;
#
# ==========================================================================
use constant START_DELAY => 30; # To give everything else time to start
use constant DBG_ID => "zmwatch"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
use constant START_DELAY => 30; # To give everything else time to start
# ==========================================================================
#

View File

@ -33,6 +33,7 @@ use bytes;
#
# ==========================================================================
use constant DBG_ID => "zmx10"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug
# ==========================================================================
@ -140,6 +141,7 @@ package X10Server;
use strict;
use bytes;
use ZoneMinder;
use POSIX;
use DBI;
use Socket;