tobya
(Toby Allen)
April 5, 2020, 4:04pm
1
1. My Caddy version (caddy version
):
2 rc1
2. How I run Caddy:
caddy run
a. System environment:
Windows 10
d. My complete Caddyfile or JSON config:
:2015
respond "Hello from Toby this has reloaded with info about logginf"
log {
output file d:/caddytrial/access.log
}
I have tried path with /
\
and \\
none work
3. The problem I’m having:
I reload my server with the config above but my log keeps getting written to stdout. There is no file called access.log created in the directory.
4. Error messages and/or full log output:
This is written to stdout but no file.
2020/04/05 16:02:38.519 e[34mINFOe[0m http.log.access handled request {“request”: {“method”: “GET”, “uri”: “/favicon.ico”, “proto”: “HTTP/1.1”, “remote_addr”: “[::1]:52126”, “host”: “localhost:2015”, “headers”: {“Sec-Fetch-Mode”: [“no-cors”], “User-Agent”: [“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”], “Sec-Fetch-Dest”: [“image”], “Accept”: [“image/webp,image/apng,image/, /*;q=0.8”], “Sec-Fetch-Site”: [“same-origin”], “Connection”: [“keep-alive”], “Pragma”: [“no-cache”], “Cache-Control”: [“no-cache”], “Referer”: [“http://localhost:2015/?sdfglksdjfg ”], “Accept-Encoding”: [“gzip, deflate, br”], “Accept-Language”: [“en-US,en;q=0.9”]}}, “common_log”: “::1 - - [05/Apr/2020:17:02:38 +0100] "GET /favicon.ico HTTP/1.1" 200 57”, “latency”: 0, “size”: 57, “status”: 200, “resp_headers”: {“Server”: [“Caddy”], “Content-Type”: }}
5. What I already tried:
6. Links to relevant resources:
tobya
(Toby Allen)
April 6, 2020, 8:58pm
2
Just giving this a little nudge up the show. Anyone have any idea what the issue is here?
Mohammed90
(Mohammed Al Sahaf)
April 7, 2020, 12:15am
3
I’d have to spin up a Windows VM on AWS to try the different scenarios, but can you try configs on the JSON level? Here’s something that works for me (different file name though because I’m on Mac):
{
"logging": {
"logs": {
"default": {
"writer": {
"filename": "d:/caddytrial/access.log",
"output": "file"
}
}
}
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":2015"
],
"routes": [
{
"handle": [
{
"handler": "static_response",
"status_code": "200",
"body": "Hello from Toby this has reloaded with info about logging"
}
],
"terminal": true
}
],
"logs": {
"logger_names": {
"localhost": "default"
}
}
}
}
}
}
}
1 Like
tobya
(Toby Allen)
April 8, 2020, 7:13am
4
Thanks, that worked.
I have provided here the caddyfile and the conversion to json which doesnt work, it might give some clues as to what is going on
:2015
respond "Hello from Toby this has reloaded with info about loggin CADDYFILE C"
log {
output file "d:/caddytrial/accessC.log"
}
{
"logging": {
"logs": {
"log0": {
"writer": {
"filename": "d:/caddytrial/accessC.log",
"output": "file"
},
"include": [
"http.log.access.log0"
]
}
}
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":2015"
],
"routes": [
{
"handle": [
{
"body": "Hello from Toby this has reloaded with info about loggin CADDYFILE C",
"handler": "static_response"
}
]
}
],
"logs": {
"logger_names": {
":2015": "log0"
}
}
}
}
}
}
}
Seems like the only difference is the logger named “default” which is a catch-all. But IMO what you wrote should work… seems like a bug @matt
matt
(Matt Holt)
April 8, 2020, 3:25pm
6
Toby, can you try with the latest on master? I seem to remember pushing a fix for loggers recently.
matt
(Matt Holt)
April 8, 2020, 4:14pm
8
I think that was it, yes. Might not have anything to do with it, but just a thought.
Mohammed90
(Mohammed Al Sahaf)
April 8, 2020, 5:03pm
9
This is what I was trying to validate @matt , that change works for me while rc1 doesn’t, just as Toby reports.
2 Likes
matt
(Matt Holt)
April 8, 2020, 8:49pm
10
Spent a few hours on this and a couple other edge cases I discovered. This should work then: httpcaddyfile, caddytls: Multiple edge case fixes; add tests · caddyserver/caddy@28fdf64 · GitHub - please try it out!
tobya
(Toby Allen)
Closed
May 8, 2020, 8:49pm
11
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.