Skip to content

Logs are printed with a leading space when using --no-log-prefix #9464

Closed
@jan4843

Description

@jan4843

Description

The --no-log-prefix option causes logs to be printed with an extra space at the beginning of each line.

Steps to reproduce the issue:

Run the up or logs commands with the --no-log-prefix option in any project with logs output. For example, for this Compose file:

services:
  foo:
    image: busybox
    entrypoint: date

Describe the results you received:

$ docker compose logs --no-log-prefix 
 Sat May 14 08:55:42 UTC 2022

Describe the results you expected:

$ docker compose logs --no-log-prefix 
Sat May 14 08:55:42 UTC 2022

Additional information you deem important (e.g. issue happens only occasionally):

Docker Compose v1 (v1.29.2 at least) does not print the extra leading space.

Output of docker compose version:

Docker Compose version v2.5.0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2)
  compose: Docker Compose (Docker Inc., v2.5.0)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 7
 Server Version: 20.10.14
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8
 runc version: v1.0.3-0-gf46b6ba
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.104-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 7.75GiB
 Name: docker-desktop
 ID: TYGH:6H7K:GX56:6WOD:2AQ3:32WZ:77TX:R4EF:GHIA:APVJ:UUZK:NCB4
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions