Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
dd435b51
Commit
dd435b51
authored
Apr 08, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Redirect stderr to errorlog file
parent
ff60cc6b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
src/shrpx.cc
src/shrpx.cc
+7
-0
src/shrpx_log.cc
src/shrpx_log.cc
+10
-0
src/shrpx_log.h
src/shrpx_log.h
+2
-0
No files found.
src/shrpx.cc
View file @
dd435b51
...
...
@@ -422,6 +422,7 @@ void reopen_log_signal_cb(struct ev_loop *loop, ev_signal *w, int revents) {
}
(
void
)
reopen_log_files
();
redirect_stderr_to_errorlog
();
if
(
get_config
()
->
num_worker
>
1
)
{
conn_handler
->
worker_reopen_log_files
();
...
...
@@ -636,6 +637,10 @@ int event_loop() {
// We get new PID after successful daemon().
mod_config
()
->
pid
=
getpid
();
// daemon redirects stderr file descriptor to /dev/null, so we
// need this.
redirect_stderr_to_errorlog
();
}
if
(
get_config
()
->
pid_file
)
{
...
...
@@ -1916,6 +1921,8 @@ int main(int argc, char **argv) {
exit
(
EXIT_FAILURE
);
}
redirect_stderr_to_errorlog
();
if
(
get_config
()
->
uid
!=
0
)
{
if
(
log_config
()
->
accesslog_fd
!=
-
1
&&
fchown
(
log_config
()
->
accesslog_fd
,
get_config
()
->
uid
,
...
...
src/shrpx_log.cc
View file @
dd435b51
...
...
@@ -324,4 +324,14 @@ int reopen_log_files() {
return
res
;
}
void
redirect_stderr_to_errorlog
()
{
auto
lgconf
=
log_config
();
if
(
get_config
()
->
errorlog_syslog
||
lgconf
->
errorlog_fd
==
-
1
)
{
return
;
}
dup2
(
lgconf
->
errorlog_fd
,
STDERR_FILENO
);
}
}
// namespace shrpx
src/shrpx_log.h
View file @
dd435b51
...
...
@@ -143,6 +143,8 @@ void upstream_accesslog(const std::vector<LogFragment> &lf, LogSpec *lgsp);
int
reopen_log_files
();
void
redirect_stderr_to_errorlog
();
}
// namespace shrpx
#endif // SHRPX_LOG_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment