Closed denysobukh closed 5 years ago
@denysobukh are you using systemd, or another similar service, to manage how gitea runs?
Yes, I'm using systemd to run gitea: here is the service file:
$ cat /etc/systemd/system/gitea.service
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
#After=mysqld.service
#After=postgresql.service
#After=memcached.service
#After=redis.service
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
# If you want to bind Gitea to a port below 1024 uncomment
# the two values below
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
I have the same issue; http.log is blank. This is probably because gitea just spits out http logs to stdout, which systemd then redirects to the syslog: https://unix.stackexchange.com/a/57243
If you run git from the command line you'll get this output. Workarounds include changing the ExecStart in the service file to redirect (via an ugly bash hack) to a log file in the gitea directory: https://stackoverflow.com/a/37595720 You could also disable stdout in the service file via StandardOutput=null which would silence the syslog entries but not populate http.log.
Upon further investigation it seems the go-macaron package is outputting these messages, and the fix needs to go at https://github.com/go-gitea/gitea/blob/95f0f62ea40b7b0419607e9e918f329981bcafb7/routers/routes/routes.go#L49 Instead of macaron.New, it should be .NewWithLogger with an io.Writer bound to the open file http.log
It looks like the only place http.log is used in this whole project is https://github.com/go-gitea/gitea/blob/5a62eb30df3a04e76e465824f525b4ffd920b562/routers/init.go#L77
Any updates on which version this fix will include?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Hi @denysobukh @jrkoenig is logging the macaron requests to the gitea.log
as my PR above a reasonable solution?
Hi @denysobukh @jrkoenig is logging the macaron requests to the
gitea.log
as my PR above a reasonable solution?
Hi @zeripath Unfortunately, I can't test this until it's in a release candidate at least. (1.7.0-rc2 haven't got it)
Ok so the gist is that the pr will redirect the Macaron log including its router logging to what is by default the gitea.log.
(The issue with sending it to http.log is that I worry that there may be concurrency problems there.)
Would that fix your issue?
Hi All As to 1.7.4 release: Routing logs still have been going to /var/log/syslog before 'DISABLE_ROUTER_LOG = true' is set
Mar 17 16:59:33 nas gitea[27124]: [Macaron] 2019-03-17 16:59:33: Started GET /admin/config for 192.168.88.200 Mar 17 16:59:33 nas gitea[27124]: [Macaron] 2019-03-17 16:59:33: Completed GET /admin/config 200 OK in 14.692245ms Mar 17 16:59:35 nas gitea[27124]: [Macaron] 2019-03-17 16:59:35: Started GET /admin/config for 192.168.88.200 Mar 17 16:59:35 nas gitea[27124]: [Macaron] 2019-03-17 16:59:35: Completed GET /admin/config 200 OK in 11.651224ms
I'm on 1.11.5, should I have this patch? Could someone explain the setting one should change to use the new method? I can't seem to stop getting the macaron logs in my systemd journal.
@agaskins yes this has been part of Gitea since #5667 and was merged in to 1.8.0!
If after having read the above you still need help:
[database]
LOG_SQL
) From the little your comment says, I think adding:
[log]
...
REDIRECT_MACARON_LOG = true
MACARON = file
ROUTER = file
Would work - however, you may want to consider dropping the router log with DISABLE_ROUTER_LOG=true
and instead use ENABLE_ACCESS_LOG=true
& ACCESS=file
as that gives a access.log that conforms to the NCSA standard like apache/nginx.
[x]
):Description: Gitea is writing HTTP log messages to syslog instead of http.log http.log is blank
app.ini
gitea dir $ ls -la /var/lib/gitea/
gitea log dir
gitea.log
syslog