Error "module not registered: caddy.logging.encoders.single_field" encountered after upgrading to 2.5.0

1. Caddy version (caddy version):

2.5.0

2. How I run Caddy:

a. System environment:

Debian 9 x64

b. Command:

systemctl restart caddy.service

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.

d. My complete Caddyfile or JSON config:

{
        http_port 80
        https_port 443
        admin off
        key_type p384
}

my.domain {

        header {
                Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
                X-XSS-Protection "1; mode=block;"
                X-Content-Type-Options nosniff
                X-Frame-Options DENY
        }

        encode gzip
        root * /var/lib/caddy/my.domain
        file_server
        tls my@mailbox {
                protocols tls1.3
                ciphers TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 TLS_AES_128_GCM_SHA256 TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256
        }

        log {
                output file /var/log/access.log
                format single_field common_log
        }

        reverse_proxy * proxy.domain {
                header_up Host proxy.domain
                header_up X-Real-IP {http.request.remote.host}
                header_up X-Forwarded-For {http.request.remote.host}
                header_up X-Forwarded-Port {http.request.port}
                header_up X-Forwarded-Proto {http.request.scheme}
                header_down Set-Cookie proxy.domain my.domain
        }

        @xray_websocket {
                path /market_investigation
                header Connection *Upgrade*
                header Upgrade websocket
        }
        reverse_proxy @xray_websocket 127.0.0.1:2048
}

3. The problem Iā€™m having:

Unable to start caddy.service .

4. Error messages and/or full log output:

ā— caddy.service - Caddy
Loaded: loaded (/etc/systemd/system/caddy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-04-27 00:02:43 HKT; 1min 49s ago
Docs: Welcome ā€” Caddy Documentation
Process: 1927 ExecStart=/usr/local/bin/caddy run --environ --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
Main PID: 1927 (code=exited, status=1/FAILURE)

Apr 27 00:02:43 caddy[1927]: HOME=/var/lib/caddy
Apr 27 00:02:43 caddy[1927]: LOGNAME=caddy
Apr 27 00:02:43 caddy[1927]: USER=caddy
Apr 27 00:02:43 caddy[1927]: INVOCATION_ID=2272c449a52d4156b25c1ff438ff4fa8
Apr 27 00:02:43 caddy[1927]: JOURNAL_STREAM=9:81627
Apr 27 00:02:43 caddy[1927]: {ā€œlevelā€:ā€œinfoā€,ā€œtsā€:1650988963.8553007,ā€œmsgā€:ā€œusing provided configurationā€,ā€œconfig_fileā€:"/etc/caddy/Caddyfile",ā€œconfig_adapterā€:""}
Apr 27 00:02:43 caddy[1927]: run: adapting config using caddyfile: parsing caddyfile tokens for ā€˜logā€™: /etc/caddy/Caddyfile:27 - Error during parsing: getting module named ā€˜caddy.logging.encoders.single_fieldā€™: module not registered: caddy.logging.encoders.single_field
Apr 27 00:02:43 systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Apr 27 00:02:43 systemd[1]: caddy.service: Failed with result ā€˜exit-codeā€™.
Apr 27 00:02:43 systemd[1]: Failed to start Caddy.
~

5. What I already tried:

Deleted the row of ā€œformat single_field common_logā€ content of Caddyfile .

6. Links to relevant resources:

Yes, it was removed. It was deprecated for many versions. See the release notes:

2 Likes

Ahhh , all right , it seemed this changes didnā€™t make any difference lol .

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.