Skip to content

Add option, to log to file #1933

@lonix1

Description

@lonix1

Clear and concise description of the problem

BACKGROUND

Woodpecker seems to log to stdout only, and thus to docker's built-in "json driver". The logs can be access like so:

  • $ docker logs -t $CONTAINER_NAME
  • tail -f /var/lib/docker/containers/$CONTAINER_ID/$CONTAINER_ID-json.log

PROBLEM

When the container is recycled, the logs are lost. The workaround is to use another logging tool, but that is unnecessary complexity, especially for small deployments.

Also, in general, the logs are not in a friendly format - it's much simpler, especially in small deployments, to simply have the log in a file that can be easily manipulated. Not everyone uses large complex logging apps and servers, etc.

Suggested solution

SOLUTION

Many apps have an option to log to file as well. Gitea does that, for example.

It would be nice if the log could be sent to a file instead of (or in addition to) stdout. If enabled, it could be written to /var/lib/woodpecker/app.log by default.

Personally, I would mount it as /var/log/woodpecker.log:/var/lib/woodpecker/app.log so that I could have it on the host, and use logrotate on it.

Alternative

An unnecessarily complicated environment that includes log aggregation and monitoring, and who knows what else. For small servers that is overkill and hard to manage.

Additional context

Thank you for considering it!

Validations

  • Checked that the feature isn't part of the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureadd new functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions