<!-- max stateful requests before a session automatically disconnects a client -->
<max_requests>97</max_requests>
+ <!-- this will disable the stderr output log for this service -->
+ <!--<diable_stderr>true</disable_stderr>-->
+
<!-- settings for the backend application drones. These are probably sane defaults -->
<unix_config>
my($class, $service, %args) = @_;
my $self = bless(\%args, $class);
- $self->{service} = $service; # service name
- $self->{num_children} = 0; # number of child processes
- $self->{osrf_handle} = undef; # xmpp handle
- $self->{routers} = []; # list of registered routers
- $self->{active_list} = []; # list of active children
- $self->{idle_list} = []; # list of idle children
+ $self->{service} = $service; # service name
+ $self->{num_children} = 0; # number of child processes
+ $self->{osrf_handle} = undef; # xmpp handle
+ $self->{routers} = []; # list of registered routers
+ $self->{active_list} = []; # list of active children
+ $self->{idle_list} = []; # list of idle children
+
+ $self->{stderr_log} = $self->{stderr_log_path} . "/${service}_stderr.log"
+ if $self->{stderr_log_path};
$self->{min_spare_children} ||= 0;
$SIG{$_} = 'DEFAULT' for (qw/INT TERM QUIT HUP/);
+ if($self->{stderr_log}) {
+
+ $chatty and $logger->internal("server: redirecting STDERR to " . $self->{stderr_log});
+
+ close STDERR;
+ unless( open(STDERR, '>>' . $self->{stderr_log}) ) {
+ $logger->error("server: unable to open STDERR log file: " . $self->{stderr_log} . " : $@");
+ open STDERR, '>/dev/null'; # send it back to /dev/null
+ }
+ }
+
$child->{pid} = $$;
eval {
$child->init;
# kill the temp connection
OpenSRF::Transport::PeerHandle->retrieve->disconnect;
+
+ # if this service does not want stderr output, it will be redirected to /dev/null
+ my $disable_stderr = $getval->('disable_stderr') || '';
+ my $stderr_path = ($disable_stderr =~ /true/i) ? undef : $sclient->config_value(dirs => 'log');
my $server = OpenSRF::Server->new(
$service,
max_children => $getval->(unix_config => 'max_children') || 20,
min_children => $getval->(unix_config => 'min_children') || 1,
min_spare_children => $getval->(unix_config => 'min_spare_children'),
- max_spare_children => $getval->(unix_config => 'max_spare_children')
+ max_spare_children => $getval->(unix_config => 'max_spare_children'),
+ stderr_log_path => $stderr_path
);
while(1) {