MT#4229 Remove dump from logfile.

The stack-trace is undecodeable from syslog, and it usually doesn't
provide any additional infos on top of the actual error message.
gjungwirth/fix_tests
Andreas Granig 12 years ago
parent 329b831918
commit 1d873fce27

@ -1,12 +1,8 @@
package NGCP::Panel::Controller::Root; package NGCP::Panel::Controller::Root;
use Sipwise::Base; use Sipwise::Base;
BEGIN { extends 'Catalyst::Controller' } BEGIN { extends 'Catalyst::Controller' }
use Carp qw(longmess);
use Convert::Ascii85 qw();
use Data::Dumper qw(Dumper);
use DateTime qw(); use DateTime qw();
use DateTime::Format::RFC3339 qw(); use DateTime::Format::RFC3339 qw();
use IO::Compress::Xz qw(xz);
use NGCP::Panel::Widget; use NGCP::Panel::Widget;
use Scalar::Util qw(blessed); use Scalar::Util qw(blessed);
use Time::HiRes qw(); use Time::HiRes qw();
@ -147,23 +143,7 @@ sub end :Private {
my $incident = DateTime->from_epoch(epoch => Time::HiRes::time); my $incident = DateTime->from_epoch(epoch => Time::HiRes::time);
my $incident_id = sprintf '%X', $incident->strftime('%s%N'); my $incident_id = sprintf '%X', $incident->strftime('%s%N');
my $incident_timestamp = DateTime::Format::RFC3339->new->format_datetime($incident); my $incident_timestamp = DateTime::Format::RFC3339->new->format_datetime($incident);
my $crash_state; $c->log->error("fatal error, id=$incident_id, timestamp=$incident_timestamp, error=".join(q(), @{ $c->error }));
$c->log->error(join(q(), @{ $c->error }));
if ($c->config->{log_crash_state}) {
local $Data::Dumper::Indent = 1;
local $Data::Dumper::Useqq = 1;
local $Data::Dumper::Deparse = 1;
local $Data::Dumper::Quotekeys = 0;
local $Data::Dumper::Sortkeys = 1;
my $buffer;
xz(\(join(q(), @{ $c->error }) . longmess . Dumper($c) . Dumper($c->config)), \$buffer);
$crash_state = Convert::Ascii85::encode($buffer);
$crash_state =~ s/(.{80})/$1\n/g;
}
$c->log->error(
"Exception id $incident_id at $incident_timestamp crash_state:" .
($crash_state ? ("\n" . $crash_state) : ' disabled')
);
$c->clear_errors; $c->clear_errors;
$c->stash( $c->stash(
exception_incident => $incident_id, exception_incident => $incident_id,

@ -10,9 +10,6 @@ log4perl.appender.Default.layout=PatternLayout
log4perl.appender.Default.layout.ConversionPattern=%d{ISO8601} [%p] [%F +%L] %m{chomp}%n log4perl.appender.Default.layout.ConversionPattern=%d{ISO8601} [%p] [%F +%L] %m{chomp}%n
# perhaps also add: host=%H pid=%P # perhaps also add: host=%H pid=%P
# each crash state is <50 KiB
log_crash_state 0
<Model::DB> <Model::DB>
schema_class NGCP::Schema schema_class NGCP::Schema
</Model::DB> </Model::DB>
@ -82,5 +79,3 @@ log_crash_state 0
keyfile /etc/ssl/ngcp/api/ca-key.pem keyfile /etc/ssl/ngcp/api/ca-key.pem
certfile /etc/ssl/ngcp/api/ca-cert.pem certfile /etc/ssl/ngcp/api/ca-cert.pem
</ssl> </ssl>
cache_root /run/shm

@ -119,6 +119,7 @@ $(function () {
$('a').each(function() { $('a').each(function() {
var _text = $(this).text().trim(); var _text = $(this).text().trim();
if(_text == "Back" || if(_text == "Back" ||
$(this).hasClass('ngcp-error-button') ||
$(this).hasClass('accordion-toggle') || $(this).hasClass('accordion-toggle') ||
$(this).parents('#footer').length || $(this).parents('#footer').length ||
$(this).parents('#topbar').length) { $(this).parents('#topbar').length) {

@ -4,32 +4,24 @@
<div class="error-container"> <div class="error-container">
<h1>Oops!</h1> <h1>Sorry!</h1>
<h2>[% c.response.status %] Internal server error </h2> <h2>[% c.response.status %] Internal server error </h2>
<div class="error-details"> <div class="error-details">
<p>Sorry, an exceptional error has occured:</p> <p>We are terribly sorry, an exceptional error has occured:</p>
<ul> <div><strong>incident number:</strong> [% exception_incident %]</div>
<li>incident number: [% exception_incident %]</li> <div><strong>time of incident:</strong> [% exception_timestamp %]</div>
<li>time of incident: [% exception_timestamp %]</li> <br/>
</ul>
<p>Details have been logged on the server. If you want to report the error, <p>Details have been logged on the server. If you want to report the error,
describe what you were doing or attempting to do just before.</p> describe what you were doing or attempting to do just before.</p>
</div> <!-- /error-details --> </div> <!-- /error-details -->
<div class="error-actions"> <div class="error-actions">
<a href="[% c.uri_for('/back') %]" class="btn btn-large btn-primary"> <a href="[% c.uri_for('/back') %]" class="btn btn-large btn-primary ngcp-error-button">
<i class="icon-chevron-left"></i> <i class="icon-chevron-left"></i> Back to Dashboard</a>
&nbsp; <a href="mailto:[% c.config.contact.email %]?subject=NGCP-Panel Incident [% exception_incident %]" class="btn btn-large ngcp-error-button">
Back to Dashboard <i class="icon-envelope"></i> Contact Support</a>
</a>
<a href="mailto:[% c.config.contact.email %]" class="btn btn-large">
<i class="icon-envelope"></i>
&nbsp;
Contact Support
</a>
</div> <!-- /error-actions --> </div> <!-- /error-actions -->

Loading…
Cancel
Save