summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Constants.pm1
-rw-r--r--Bugzilla/DaemonControl.pm6
-rw-r--r--Bugzilla/Error.pm2
-rw-r--r--Bugzilla/Install/Filesystem.pm8
-rw-r--r--Bugzilla/Logging.pm11
5 files changed, 24 insertions, 4 deletions
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index 80d9c4e0c..3aa7b0fa4 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -693,6 +693,7 @@ sub _bz_locations {
# The script should really generate these graphs directly...
'webdotdir' => "$datadir/webdot",
'extensionsdir' => "$libpath/extensions",
+ 'logsdir' => "$libpath/logs",
'assetsdir' => "$datadir/assets",
'confdir' => $confdir,
};
diff --git a/Bugzilla/DaemonControl.pm b/Bugzilla/DaemonControl.pm
index 6586cc01b..2c6df1b87 100644
--- a/Bugzilla/DaemonControl.pm
+++ b/Bugzilla/DaemonControl.pm
@@ -81,7 +81,13 @@ sub run_cereal {
on_exception => on_exception( 'cereal', $exit_f ),
);
$exit_f->on_cancel( sub { $cereal->kill('TERM') } );
+ $exit_f->on_ready(
+ sub {
+ delete $ENV{LOG4PERL_STDERR_DISABLE};
+ }
+ );
$loop->add($cereal);
+ $ENV{LOG4PERL_STDERR_DISABLE} = 1;
return $exit_f;
}
diff --git a/Bugzilla/Error.pm b/Bugzilla/Error.pm
index ef57303e9..9fcd16386 100644
--- a/Bugzilla/Error.pm
+++ b/Bugzilla/Error.pm
@@ -169,7 +169,7 @@ sub ThrowUserError {
sub ThrowCodeError {
my ($error, $vars) = @_;
- my $logfunc = _make_logfunc('User');
+ my $logfunc = _make_logfunc('Code');
_add_vars_to_logging_fields($vars);
_throw_error( 'global/code-error.html.tmpl', $error, $vars, $logfunc );
diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm
index 70b195090..094226891 100644
--- a/Bugzilla/Install/Filesystem.pm
+++ b/Bugzilla/Install/Filesystem.pm
@@ -36,6 +36,7 @@ use Cwd ();
use File::Slurp;
use IO::File;
use POSIX ();
+use English qw(-no_match_vars $OSNAME);
use base qw(Exporter);
our @EXPORT = qw(
@@ -106,6 +107,7 @@ use constant HTTPD_ENV => qw(
LOCALCONFIG_ENV
BUGZILLA_UNSAFE_AUTH_DELEGATION
LOG4PERL_CONFIG_FILE
+ LOG4PERL_STDERR_DISABLE
USE_NYTPROF
NYTPROF_DIR
);
@@ -162,6 +164,8 @@ sub DIR_CGI_OVERWRITE { _group() ? 0770 : 0777 };
# (or their subdirectories) to the user, via the webserver.
sub DIR_ALSO_WS_SERVE { _suexec() ? 0001 : 0 };
+sub DIR_ALSO_WS_STICKY { $OSNAME eq 'linux' ? 02000 : 0 }
+
# This looks like a constant because it effectively is, but
# it has to call other subroutines and read the current filesystem,
# so it's defined as a sub. This is not exported, so it doesn't have
@@ -186,6 +190,7 @@ sub FILESYSTEM {
my $template_cache = bz_locations()->{'template_cache'};
my $graphsdir = bz_locations()->{'graphsdir'};
my $assetsdir = bz_locations()->{'assetsdir'};
+ my $logsdir = bz_locations()->{'logsdir'};
# We want to set the permissions the same for all localconfig files
# across all PROJECTs, so we do something special with $localconfig,
@@ -277,6 +282,8 @@ sub FILESYSTEM {
dirs => DIR_CGI_WRITE | DIR_ALSO_WS_SERVE },
"$datadir/db" => { files => CGI_WRITE,
dirs => DIR_CGI_WRITE },
+ $logsdir => { files => CGI_WRITE,
+ dirs => DIR_CGI_WRITE | DIR_ALSO_WS_STICKY },
$assetsdir => { files => WS_SERVE,
dirs => DIR_CGI_OVERWRITE | DIR_ALSO_WS_SERVE },
@@ -361,6 +368,7 @@ sub FILESYSTEM {
$webdotdir => DIR_CGI_WRITE | DIR_ALSO_WS_SERVE,
$assetsdir => DIR_CGI_WRITE | DIR_ALSO_WS_SERVE,
$template_cache => DIR_CGI_WRITE,
+ $logsdir => DIR_CGI_WRITE | DIR_ALSO_WS_STICKY,
# Directories that contain content served directly by the web server.
"$skinsdir/custom" => DIR_WS_SERVE,
"$skinsdir/contrib" => DIR_WS_SERVE,
diff --git a/Bugzilla/Logging.pm b/Bugzilla/Logging.pm
index 4a7abcb21..f334435fc 100644
--- a/Bugzilla/Logging.pm
+++ b/Bugzilla/Logging.pm
@@ -12,12 +12,17 @@ use warnings;
use Log::Log4perl qw(:easy);
use Log::Log4perl::MDC;
-use File::Spec::Functions qw(rel2abs);
+use File::Spec::Functions qw(rel2abs catfile);
use Bugzilla::Constants qw(bz_locations);
use English qw(-no_match_vars $PROGRAM_NAME);
+use Taint::Util qw(untaint);
-sub is_interactive {
- return not exists $ENV{SERVER_SOFTWARE}
+sub logfile {
+ my ($class, $name) = @_;
+
+ my $file = rel2abs(catfile(bz_locations->{logsdir}, $name));
+ untaint($file);
+ return $file;
}
sub fields {