Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
1e8ab1ca
Commit
1e8ab1ca
authored
Apr 18, 2017
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpserver: Don't close stdout or stderr when closing logs (fix #1471)
parent
729e4f02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
caddyhttp/httpserver/logger.go
caddyhttp/httpserver/logger.go
+5
-3
No files found.
caddyhttp/httpserver/logger.go
View file @
1e8ab1ca
...
@@ -91,17 +91,14 @@ selectwriter:
...
@@ -91,17 +91,14 @@ selectwriter:
switch
l
.
Output
{
switch
l
.
Output
{
case
""
,
"stderr"
:
case
""
,
"stderr"
:
l
.
writer
=
os
.
Stderr
l
.
writer
=
os
.
Stderr
case
"stdout"
:
case
"stdout"
:
l
.
writer
=
os
.
Stdout
l
.
writer
=
os
.
Stdout
case
"syslog"
:
case
"syslog"
:
l
.
writer
,
err
=
gsyslog
.
NewLogger
(
gsyslog
.
LOG_ERR
,
"LOCAL0"
,
"caddy"
)
l
.
writer
,
err
=
gsyslog
.
NewLogger
(
gsyslog
.
LOG_ERR
,
"LOCAL0"
,
"caddy"
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
default
:
default
:
if
address
:=
parseSyslogAddress
(
l
.
Output
);
address
!=
nil
{
if
address
:=
parseSyslogAddress
(
l
.
Output
);
address
!=
nil
{
l
.
writer
,
err
=
gsyslog
.
DialLogger
(
address
.
network
,
address
.
address
,
gsyslog
.
LOG_ERR
,
"LOCAL0"
,
"caddy"
)
l
.
writer
,
err
=
gsyslog
.
DialLogger
(
address
.
network
,
address
.
address
,
gsyslog
.
LOG_ERR
,
"LOCAL0"
,
"caddy"
)
...
@@ -136,6 +133,11 @@ selectwriter:
...
@@ -136,6 +133,11 @@ selectwriter:
// Close closes open log files or connections to syslog.
// Close closes open log files or connections to syslog.
func
(
l
*
Logger
)
Close
()
error
{
func
(
l
*
Logger
)
Close
()
error
{
// don't close stdout or stderr
if
l
.
writer
==
os
.
Stdout
||
l
.
writer
==
os
.
Stderr
{
return
nil
}
// Will close local/remote syslog connections too :)
// Will close local/remote syslog connections too :)
if
closer
,
ok
:=
l
.
writer
.
(
io
.
WriteCloser
);
ok
{
if
closer
,
ok
:=
l
.
writer
.
(
io
.
WriteCloser
);
ok
{
l
.
fileMu
.
Lock
()
l
.
fileMu
.
Lock
()
...
...
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