From f76e1350b27134dd2ac4c785d522dc9e49a38697 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 18 Feb 2020 13:22:35 +0100 Subject: [PATCH] Bug 24071: Add a way to export debug info Actually this patch does much more, but still not enough. There are 2 goals that I would like to achieve with this patch: * Add an entry point to the Koha wiki from Koha * Explain a bit how to report a from within Koha, and export useful data TODO: * Stylish * Fix wording * Improve exported file (must be either a .txt or .zip with other text files, not a .pdf) * Display other log files, not only plack-error.log * Display the bottom of the log file, not the beginning * Only display the last X lines of the logs (500?) * Is there a way to retrieve the content of the JS console (sounds impossible to get it from other tabs anyway, unless we copy it in the local storage, which seems wrong). * Main question: how critical it is to display the log file? Is that ok to display it for superlibrarian only? They will need to be warned that the file could contain potential data they do not want to share publicly (IP, DB name, etc.). --- about.pl | 8 ++ koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 110 +++++++++++++++++++++++ 2 files changed, 118 insertions(+) diff --git a/about.pl b/about.pl index 184e9375db..17dca46b8b 100755 --- a/about.pl +++ b/about.pl @@ -25,6 +25,7 @@ use Modern::Perl; use CGI qw ( -utf8 ); use DateTime::TimeZone; use File::Spec; +use File::Slurp qw( read_file ); use List::MoreUtils qw/ any /; use LWP::Simple; use Module::Load::Conditional qw(can_load); @@ -702,4 +703,11 @@ if ( open( my $file, "<:encoding(UTF-8)", "$docdir" . "/history.txt" ) ) { $template->param( timeline_read_error => 1 ); } +my $logdir = C4::Context->config('logdir'); +my $plack_error_log = read_file("$logdir/plack-error.log"); +# TODO could add SIP, indexer, Zebra +$template->param( + plack_error_log => $plack_error_log, +); + output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index 61927acbbc..c6b0c4e32b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -28,6 +28,7 @@
  • Licenses
  • Translations
  • Timeline
  • +
  • The Koha community
  • @@ -796,14 +797,123 @@ [% END %]
    + + +
    +

    Get in touch with the Koha community

    +

    There are several ways to get in touch with the Koha community.

    +

    Most of them are listed on the Getting involved page of the wiki. + You will learn how to improve the manual, become a translator, open a bug report, test bugs, and even write your own patches!

    + +

    Open a new bug report

    +

    We would like to give you some hints about how to open a new bug report on our bug trackers.

    +

    Before opening a bug report you need to make sure that this is a real bug. + You also need to ask your support provider, if you have one, to confirm the bug for you.

    +

    What would be the different steps before opening a new bug report?

    +

    You should first make sure it is not fixed yet or it is not a configuration issue. To do so you should try and recreate the bug on one of the sandboxes provided by the community.

    +

    If you recreate it on the sandbox you can note the different steps and describe them on the bug report you are going to open.

    +

    It is also important to provide the different information:

    +
    + + + + + + + [% IF (is_psgi) %] + + [% END %] + [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %] + + + [% IF elasticsearch_fatal_config_error %] + + [% ELSE %] + + [% END %] + + [% END %] + + + + + [% IF (errZebraConnection == 10000) %] + + [% ELSIF (errZebraConnection) %] + + [% END %] +
    Koha version: [% kohaVersion | html %]
    OS version ('uname -a'): [% osVersion | html %]
    Perl interpreter: [% perlPath | html %]
    Perl version: [% perlVersion | html %]
    MySQL version: [% mysqlVersion | html %]
    PSGI: [% psgi_server | html %]
    Elasticsearch: [% elasticsearch_fatal_config_error | html %] + Nodes: + [% elasticsearch_status.nodes.join(' / ') | html %] + | + Status: + [% IF elasticsearch_status.running %] + running + | + Indices: + [% FOREACH index IN elasticsearch_status.indexes %] + [% index.index_name | html %] (count: [% index.count | html %])[% UNLESS loop.last %], [% END %] + [% END %] + [% ELSE %] + not running + [% END %] +
    Memcached: + Servers: [% IF memcached_servers %][% memcached_servers | html %] + [% ELSE %]undefined[% END %] | + Namespace: [% IF memcached_namespace %][% memcached_namespace | html %] + [% ELSE %]undefined[% END %] | + Status: [% IF memcached_servers %] + [% IF memcached_running and is_memcached_still_active %] + running. + [% ELSE %] + not running. + [% IF is_psgi %] + Remember memcached needs to be started before Plack. + [% END %] + [% END %] + [% ELSE %] + unknown + [% END %] | + Config read from: + [% SWITCH where_is_memcached_config %] + [% CASE 'config_only' %] + koha-conf.xml + [% CASE 'ENV_only' %] + ENV Note that the right place to define the memcached config is in your $KOHA_CONF file + [% CASE 'both' %] + ENV and koha-conf.xml Note that the right place to define the memcached config is in your $KOHA_CONF file. To avoid any misunderstanding you should not export the memcached config from ENV. + [% CASE # nowhere %] + Nowhere Note that the right place to define the memcached config is in your $KOHA_CONF file. Currently you do not have a valid memcached configuration defined. + [% END %] + [% IF effective_caching_method != 'Cache::Memcached::Fast::Safe' %] + | Effective caching method: [% effective_caching_method | html %] + [% END %] +
    Zebra version: [% zebraVersion | html %]
    Error Zebra server seems not to be available. Is it started?
    Warning Error message from Zebra: [% ( errZebraConnection ) | html %]
    + +
      +
    1. + Plack error log: +
    2. +
    +
    + +
    [% MACRO jsinclude BLOCK %] [% END %] -- 2.11.0