* Adds a localconfig var called "logging_method" which points at a config file in the conf directory (which config file to use, there are several that preconfigure log4perl to log various different ways).
* Set the default to syslog.
{name => 'memcached_namespace', default => "bugzilla:",},
{name => 'urlbase', default => '',},
{name => 'canonical_urlbase', lazy => 1},
+ {name => 'logging_method', default => 'syslog'},
{name => 'nobody_user', default => 'nobody@mozilla.org'},
{name => 'attachment_base', default => '',},
{name => 'ses_username', default => '',},
use Log::Log4perl::MDC;
use File::Spec::Functions qw(rel2abs catfile);
use Bugzilla::Constants qw(bz_locations);
+use Bugzilla::Install::Localconfig;
use English qw(-no_match_vars $PROGRAM_NAME);
sub logfile {
}
BEGIN {
- my $file = $ENV{LOG4PERL_CONFIG_FILE} // 'log4perl-default.conf';
+ my $lc = Bugzilla::Install::Localconfig::read_localconfig();
+ # Use the environment variable if it exists, otherwise use the value
+ # from localconfig, or if that's not set, use syslog.
+ my $file = $ENV{LOG4PERL_CONFIG_FILE} // ("log4perl-" . ($lc->{'logging_method'} // 'syslog') . ".conf");
Log::Log4perl::Logger::create_custom_level('NOTICE', 'WARN', 5, 2);
Log::Log4perl->init(rel2abs($file, bz_locations->{confdir}));
TRACE("logging enabled in $PROGRAM_NAME");
get_text template_var disable_utf8
enable_utf8 detect_encoding email_filter
round extract_nicks);
-use Bugzilla::Logging;
+# Bugzilla::Logging cannot be used it this file due to circular dependency
+#use Bugzilla::Logging;
use Bugzilla::Constants;
use Bugzilla::RNG qw(irand);
# If we're already running under SSL, never redirect.
return if $ENV{HTTPS} && $ENV{HTTPS} eq 'on';
- DEBUG("Redirect to HTTPS because \$ENV{HTTPS}=$ENV{HTTPS}");
Bugzilla->cgi->redirect_to_https();
}
The defaults need to be updated to log to a more generic location users are
likely to have, or walk through setting it during the installation script.
+**[COMPLETED]**
+
# Docker and Containerization
I would like the Dockerfile to be rewritten such that the ENTRYPOINT is the
log4perl.rootLogger = INFO, Syslog
log4perl.appender.Syslog = Log::Dispatch::Syslog
log4perl.appender.Syslog.min_level = notice
-log4perl.appender.Syslog.ident = apache
-log4perl.appender.Syslog.facility = local4
+log4perl.appender.Syslog.ident = bugzilla
+log4perl.appender.Syslog.facility = daemon
log4perl.appender.Syslog.logopt = cons,pid
log4perl.appender.Syslog.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.Syslog.layout.ConversionPattern = [%c] %m{chomp}%n
If you want to use the "Difference Between Two Patches" feature of the
Patch Viewer, please specify the full path to the "interdiff" executable
here.
+END
+ localconfig_logging_method => <<'END',
+This option specifies the method to use to log any errors or debug messages
+create by Bugzilla. This will use the configuration found in conf/log4perl-{logging_method}.conf so anything listed there is valid. Examples are 'syslog', 'docker', 'file', and 'json'.
END
localconfig_memcached_servers => <<'END',
If this option is set, Bugzilla will integrate with Memcached.