Log mode changed to console after installation #10895

Closed
opened 2025-11-02 09:21:24 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @alex-ibb on GitHub (May 22, 2023).

Description

Docker image: gitea/gitea:1.19.3
Platform: x64
OS: Ubuntu 22.04.3 Server (Minimized)

Problem: the value of log__MODE changed to console after the initialization step.

Steps to reproduce:

  1. Install the OS, docker and docker-compose
  2. Draft an docker-compose.yml file with the following log related section:
      # [log]
      - GITEA__log__MODE=file
      - GITEA__log__LEVEL=Info
      - GITEA__log__ROUTER=file
      - GITEA__log__ROOT_PATH=/data/gitea/log/
      - GITEA__log__ENABLE_XORM_LOG=true #
      - GITEA__log__MAX_SIZE_SHIFT=28    # 单个日志文件最大大小,当为28时:2^28/1024^2=> 258(MB)
      - GITEA__log__FILE_NAME=gitea.log  # 即日志的路径为`/data/gitea/log/gitea.log`
      - GITEA__log__XORM=file

      # [log.file]
      - GITEA__log.file__MAX_DAYS=180 # 多少天后删除日志文件
      - GITEA__log.file__COMPRESSION_LEVEL=1 # 日志文件的压缩等级

      # [log.file.router]
      - GITEA__log.file.router__FILE_NAME=router.log

      # [log.file.xorm]
      - GITEA__log.file.xorm__FILE_NAME=xorm.log
  1. type docker-compose -f docker-compose.yml up -d to start the container and open its site for initialization.
  2. after filling the Administrator Account Settings section, using cat <container_root>/data/gitea/conf/app.ini to check log related settings, it reads:
[log]
MODE            = file
LEVEL           = Info
ROUTER          = file
ROOT_PATH       = /data/gitea/log/
ENABLE_XORM_LOG = true
MAX_SIZE_SHIFT  = 28
FILE_NAME       = gitea.log
XORM            = file
  1. hit the Install Gitea button, the site would redirect to a user page, then re-check the content, it reads:
[log]
MODE            = console
LEVEL           = info
ROUTER          = console
ROOT_PATH       = /data/gitea/log/
ENABLE_XORM_LOG = true
MAX_SIZE_SHIFT  = 28
FILE_NAME       = gitea.log
XORM            = file

The value of MODE changed to console incorrectly.
To a personal unstandering, given in the docker-compose.yml it's file and all required values related have given, it should remind to be file after the initialization.

What have I missed ?

Gitea Version

1.19.3

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Using Docker images.
The full content of the docker-compose.yml:

version: "3"

networks:
  gitea:
    external: false

volumes:
  gitea:
    driver: local

services:
  server:
    image: gitea/gitea:1.19.3
    container_name: lovegitea.gitea
    environment:
      - APP_NAME=Gitea@lovegitea
      - RUN_MODE=prod
      - USER_UID=3001
      - USER_GID=3000
      - USER=gitea_admin

      # [database]:https://docs.gitea.io/en-us/config-cheat-sheet/#database-database
      - GITEA__database__DB_TYPE=sqlite3
      - GITEA__database__DB_PATH="/data/gitea/gitea.db"

      # [repository]
      - GITEA__repository__DEFAULT_PRIVATE=private

      # [Server]:https://docs.gitea.io/en-us/config-cheat-sheet/#server-server
      - GITEA__server__DOMAIN=localhost
      # Git Clone over HTTP 相关
      - GITEA__server__HTTP_ADDR=
      - GITEA__server__HTTP_PORT=3000
      # - GITEA__server__ROOT_URL=

      # Git Clone over SSH
      - GITEA__server__DISABLE_SSH=false
      # - GITEA__server__SSH_DOMAIN=
      - GITEA__server__SSH_PORT=10022
      - GITEA__server__SSH_LISTEN_PORT=22
      - GITEA__server__OFFLINE_MODE=false
      - GITEA__server__LANDING_PAGE=login

      # [Service]
      - GITEA__service__DEFAULT_USER_IS_RESTRICTED=true
      - GITEA__service__OFFLINE_MODE=true
      - GITEA__service__DISABLE_REGISTRATION=true
      - GITEA__service__REQUIRE_SIGNIN_VIEW=true
      - GITEA__service__REGISTER_EMAIL_CONFIRM=true
      - GITEA__service__ENABLE_NOTIFY_MAIL=true
      - GITEA__service__ALLOW_ONLY_EXTERNAL_REGISTRATION=false
      - GITEA__service__ENABLE_CAPTCHA=false
      - GITEA__service__DEFAULT_KEEP_EMAIL_PRIVATE=false
      - GITEA__service__DEFAULT_ALLOW_CREATE_ORGANIZATION=true
      - GITEA__service__DEFAULT_ENABLE_TIMETRACKING=true
      - GITEA__service__NO_REPLY_ADDRESS=noreply.gitea.lovegitea.io
      - GITEA__service__DEFAULT_KEEP_EMAIL_PRIVATE=true
      - GITEA__service__DEFAULT_ORG_VISIBILITY=private

      # [Admin]
      - GITEA__admin__DEFAULT_EMAIL_NOTIFICATIONS=enabled
      - GITEA__admin__DISABLE_REGULAR_ORG_CREATION=false

      # [Security]
      - GITEA__security__LOGIN_REMEMBER_DAYS=1
      - GITEA__security__PASSWORD_HASH_ALGO=pbkdf2

      # [OpenID]
      - GITEA__openid__ENABLE_OPENID_SIGNIN=false
      - GITEA__openid__ENABLE_OPENID_SIGNUP=false

      # [Picture]
      - GITEA__picture__DISABLE_GRAVATAR=true
      - GITEA__picture__ENABLE_FEDERATED_AVATAR=false

      # [Git.Timeout]
      - GITEA__git.timeout__DEFAUlT=3600 # Git operations default timeout seconds.
      - GITEA__git.timeout__MIGRATE=3600 # Migrate external repositories timeout seconds.
      - GITEA__git.timeout__MIRROR=3600  # Mirror external repositories timeout seconds.
      - GITEA__git.timeout__CLONE=3600   # Git clone from internal repositories timeout seconds.
      - GITEA__git.timeout__PULL=3600    # Git pull from internal repositories timeout seconds.
      - GITEA__git.timeout__GC=3600      # Git repository GC timeout seconds.

      # [Other]
      - GITEA__other__SHOW_FOOTER_VERSION=false # Whether to show Gitea version on the site
      - GITEA__other__ENABLE_FEED=false         

      # [log]
      - GITEA__log__MODE=file
      - GITEA__log__LEVEL=Info
      - GITEA__log__ROUTER=file
      - GITEA__log__ROOT_PATH=/data/gitea/log/
      - GITEA__log__ENABLE_XORM_LOG=true #
      - GITEA__log__MAX_SIZE_SHIFT=28    # 2^28/1024^2 => 258(MB)
      - GITEA__log__FILE_NAME=gitea.log  # `/data/gitea/log/gitea.log`
      - GITEA__log__XORM=file

      # [log.file]
      - GITEA__log.FILE_NAME=/data/gitea/log/gitea.log
      - GITEA__log.file__MAX_DAYS=180 #
      - GITEA__log.COMPRESS=true
      - GITEA__log.file__COMPRESSION_LEVEL=1 #

      # [log.file.router]
      - GITEA__log.file.router__FILE_NAME=router.log

      # [log.file.xorm]
      - GITEA__log.file.xorm__FILE_NAME=xorm.log

    restart: unless-stopped
    networks:
      - gitea
    volumes:
      - /docker-data/containers/lovegitea.gitea/data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "10080:3000"
      - "10022:22" # activate this line to enable SSH Clone

Database

SQLite

Originally created by @alex-ibb on GitHub (May 22, 2023). ### Description Docker image: gitea/gitea:1.19.3 Platform: x64 OS: Ubuntu 22.04.3 Server (Minimized) Problem: the value of log__MODE changed to `console` after the initialization step. Steps to reproduce: 1. Install the OS, docker and docker-compose 2. Draft an `docker-compose.yml` file with the following `log` related section: ```yml # [log] - GITEA__log__MODE=file - GITEA__log__LEVEL=Info - GITEA__log__ROUTER=file - GITEA__log__ROOT_PATH=/data/gitea/log/ - GITEA__log__ENABLE_XORM_LOG=true # - GITEA__log__MAX_SIZE_SHIFT=28 # 单个日志文件最大大小,当为28时:2^28/1024^2=> 258(MB) - GITEA__log__FILE_NAME=gitea.log # 即日志的路径为`/data/gitea/log/gitea.log` - GITEA__log__XORM=file # [log.file] - GITEA__log.file__MAX_DAYS=180 # 多少天后删除日志文件 - GITEA__log.file__COMPRESSION_LEVEL=1 # 日志文件的压缩等级 # [log.file.router] - GITEA__log.file.router__FILE_NAME=router.log # [log.file.xorm] - GITEA__log.file.xorm__FILE_NAME=xorm.log ``` 3. type `docker-compose -f docker-compose.yml up -d` to start the container and open its site for initialization. 4. after filling the `Administrator Account Settings` section, using `cat <container_root>/data/gitea/conf/app.ini` to check `log` related settings, it reads: ```yml [log] MODE = file LEVEL = Info ROUTER = file ROOT_PATH = /data/gitea/log/ ENABLE_XORM_LOG = true MAX_SIZE_SHIFT = 28 FILE_NAME = gitea.log XORM = file ``` 5. hit the `Install Gitea` button, the site would redirect to a user page, then re-check the content, it reads: ```yml [log] MODE = console LEVEL = info ROUTER = console ROOT_PATH = /data/gitea/log/ ENABLE_XORM_LOG = true MAX_SIZE_SHIFT = 28 FILE_NAME = gitea.log XORM = file ``` The value of `MODE` changed to `console` incorrectly. To a personal unstandering, given in the `docker-compose.yml` it's `file` and all required values related have given, it should remind to be `file` after the initialization. What have I missed ? ### Gitea Version 1.19.3 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Using Docker images. The full content of the `docker-compose.yml`: ```yml version: "3" networks: gitea: external: false volumes: gitea: driver: local services: server: image: gitea/gitea:1.19.3 container_name: lovegitea.gitea environment: - APP_NAME=Gitea@lovegitea - RUN_MODE=prod - USER_UID=3001 - USER_GID=3000 - USER=gitea_admin # [database]:https://docs.gitea.io/en-us/config-cheat-sheet/#database-database - GITEA__database__DB_TYPE=sqlite3 - GITEA__database__DB_PATH="/data/gitea/gitea.db" # [repository] - GITEA__repository__DEFAULT_PRIVATE=private # [Server]:https://docs.gitea.io/en-us/config-cheat-sheet/#server-server - GITEA__server__DOMAIN=localhost # Git Clone over HTTP 相关 - GITEA__server__HTTP_ADDR= - GITEA__server__HTTP_PORT=3000 # - GITEA__server__ROOT_URL= # Git Clone over SSH - GITEA__server__DISABLE_SSH=false # - GITEA__server__SSH_DOMAIN= - GITEA__server__SSH_PORT=10022 - GITEA__server__SSH_LISTEN_PORT=22 - GITEA__server__OFFLINE_MODE=false - GITEA__server__LANDING_PAGE=login # [Service] - GITEA__service__DEFAULT_USER_IS_RESTRICTED=true - GITEA__service__OFFLINE_MODE=true - GITEA__service__DISABLE_REGISTRATION=true - GITEA__service__REQUIRE_SIGNIN_VIEW=true - GITEA__service__REGISTER_EMAIL_CONFIRM=true - GITEA__service__ENABLE_NOTIFY_MAIL=true - GITEA__service__ALLOW_ONLY_EXTERNAL_REGISTRATION=false - GITEA__service__ENABLE_CAPTCHA=false - GITEA__service__DEFAULT_KEEP_EMAIL_PRIVATE=false - GITEA__service__DEFAULT_ALLOW_CREATE_ORGANIZATION=true - GITEA__service__DEFAULT_ENABLE_TIMETRACKING=true - GITEA__service__NO_REPLY_ADDRESS=noreply.gitea.lovegitea.io - GITEA__service__DEFAULT_KEEP_EMAIL_PRIVATE=true - GITEA__service__DEFAULT_ORG_VISIBILITY=private # [Admin] - GITEA__admin__DEFAULT_EMAIL_NOTIFICATIONS=enabled - GITEA__admin__DISABLE_REGULAR_ORG_CREATION=false # [Security] - GITEA__security__LOGIN_REMEMBER_DAYS=1 - GITEA__security__PASSWORD_HASH_ALGO=pbkdf2 # [OpenID] - GITEA__openid__ENABLE_OPENID_SIGNIN=false - GITEA__openid__ENABLE_OPENID_SIGNUP=false # [Picture] - GITEA__picture__DISABLE_GRAVATAR=true - GITEA__picture__ENABLE_FEDERATED_AVATAR=false # [Git.Timeout] - GITEA__git.timeout__DEFAUlT=3600 # Git operations default timeout seconds. - GITEA__git.timeout__MIGRATE=3600 # Migrate external repositories timeout seconds. - GITEA__git.timeout__MIRROR=3600 # Mirror external repositories timeout seconds. - GITEA__git.timeout__CLONE=3600 # Git clone from internal repositories timeout seconds. - GITEA__git.timeout__PULL=3600 # Git pull from internal repositories timeout seconds. - GITEA__git.timeout__GC=3600 # Git repository GC timeout seconds. # [Other] - GITEA__other__SHOW_FOOTER_VERSION=false # Whether to show Gitea version on the site - GITEA__other__ENABLE_FEED=false # [log] - GITEA__log__MODE=file - GITEA__log__LEVEL=Info - GITEA__log__ROUTER=file - GITEA__log__ROOT_PATH=/data/gitea/log/ - GITEA__log__ENABLE_XORM_LOG=true # - GITEA__log__MAX_SIZE_SHIFT=28 # 2^28/1024^2 => 258(MB) - GITEA__log__FILE_NAME=gitea.log # `/data/gitea/log/gitea.log` - GITEA__log__XORM=file # [log.file] - GITEA__log.FILE_NAME=/data/gitea/log/gitea.log - GITEA__log.file__MAX_DAYS=180 # - GITEA__log.COMPRESS=true - GITEA__log.file__COMPRESSION_LEVEL=1 # # [log.file.router] - GITEA__log.file.router__FILE_NAME=router.log # [log.file.xorm] - GITEA__log.file.xorm__FILE_NAME=xorm.log restart: unless-stopped networks: - gitea volumes: - /docker-data/containers/lovegitea.gitea/data:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro ports: - "10080:3000" - "10022:22" # activate this line to enable SSH Clone ``` ### Database SQLite
GiteaMirror added the type/bug label 2025-11-02 09:21:24 -06:00
Author
Owner

@yp05327 commented on GitHub (May 23, 2023):

It is changed in:
5c0745c034/routers/install/install.go (L462)

@yp05327 commented on GitHub (May 23, 2023): It is changed in: https://github.com/go-gitea/gitea/blob/5c0745c0349f0709d0fc36fd8a97dcab86bce28a/routers/install/install.go#L462
Author
Owner

@alex-ibb commented on GitHub (May 23, 2023):

Thank you, @CypherpunkSamurai .

It seems it will be changed to 'console' after the initilization, regardless the value in the docker-compose file.
To change it, one need to edit the app.ini after the initilization.

Wondering the considerations to force the values of MODE and ROUTER to console in the install.go.
Seems confusing.

@alex-ibb commented on GitHub (May 23, 2023): Thank you, @CypherpunkSamurai . It seems it will be changed to 'console' after the initilization, regardless the value in the docker-compose file. To change it, one need to edit the `app.ini` after the initilization. Wondering the considerations to `force` the values of `MODE` and `ROUTER` to `console` in the `install.go`. Seems confusing.
Author
Owner

@lunny commented on GitHub (May 23, 2023):

The change comes from d65cd5677a, before that commit, it's file.

@lunny commented on GitHub (May 23, 2023): The change comes from d65cd5677af3df5d616bf48dfd4be354e23c184f, before that commit, it's `file`.
Author
Owner

@alex-ibb commented on GitHub (May 24, 2023):

Copy, thank you @lunny

@zeripath
Hi~
For the commit, to change the default values of MODE and ROUTER, what are the considerations to hard-code them to "console"?

@alex-ibb commented on GitHub (May 24, 2023): Copy, thank you @lunny @zeripath Hi~ For the commit, to change the default values of MODE and ROUTER, what are the considerations to hard-code them to "console"?
Author
Owner

@wxiaoguang commented on GitHub (Jun 12, 2023):

No particular reason.

-> Do not overwrite the log mode when installing #25203

@wxiaoguang commented on GitHub (Jun 12, 2023): No particular reason. -> Do not overwrite the log mode when installing #25203
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10895