-
Notifications
You must be signed in to change notification settings - Fork 111
Misleading application logging information #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hopefully this will clear things up... When running with $ ps -ef | grep unit
andrew 804 775 0 13:23 pts/1 00:00:00 unit: main v1.33.0 [/opt/unit/sbin/unitd --no-daemon]
...
andrew 809 808 0 13:23 pts/1 00:00:00 unit: "test" application
$ ls -l /proc/809/fd/{1,2}
lrwx------ 1 andrew andrew 64 May 23 13:23 /proc/809/fd/1 -> /dev/pts/1
l-wx------ 1 andrew andrew 64 May 23 13:23 /proc/809/fd/2 -> /opt/unit/unit.log The When running as a daemon (I.e without --no-daemon) then we have $ ps -ef | grep unit
andrew 900 1 0 13:33 ? 00:00:00 unit: main v1.33.0 [/opt/unit/sbin/unitd]
...
andrew 909 908 0 13:33 ? 00:00:00 unit: "test" application
$ ls -l /proc/909/fd/{1,2}
lrwx------ 1 andrew andrew 64 May 23 13:33 /proc/909/fd/1 -> /dev/null
l-wx------ 1 andrew andrew 64 May 23 13:33 /proc/909/fd/2 -> /opt/unit/unit.log When setting the "stdout": "/tmp/unit-stdout.log",
"stderr": "/tmp/unit-stderr.log", When running with $ ps -ef | grep unit
andrew 1102 775 0 13:42 pts/1 00:00:00 unit: main v1.33.0 [/opt/unit/sbin/unitd --no-daemon]
...
andrew 1107 1106 0 13:42 pts/1 00:00:00 unit: "test" application
$ ls -l /proc/1107/fd/{1,2}
lrwx------ 1 andrew andrew 64 May 23 13:46 /proc/1107/fd/1 -> /dev/pts/1
l-wx------ 1 andrew andrew 64 May 23 13:46 /proc/1107/fd/2 -> /opt/unit/unit.log No change... Running as a daemon $ ps -ef | grep unit
andrew 1220 1 0 13:47 ? 00:00:00 unit: main v1.33.0 [/opt/unit/sbin/unitd]
...
andrew 1229 1228 0 13:47 ? 00:00:00 unit: "test" application
$ ls -l /proc/1229/fd/{1,2}
l-wx------ 1 andrew andrew 64 May 23 13:48 /proc/1229/fd/1 -> /tmp/unit-stdout.log
l-wx------ 1 andrew andrew 64 May 23 13:48 /proc/1229/fd/2 -> /tmp/unit-stderr.log The key to fixing nginx/unit#1178 is to revert the change that started running unit with |
What happens to |
To answer my own question, it looks like How come Would it be possible to direct both to the same place? Directing the output from within the service file doesn't seem to have any effect (but maybe that's the same issue as nginx/unit#1178)?
|
With
That should work when not using |
On Fri, 24 May 2024 10:08:00 -0700 MagnusOxlund ***@***.***> wrote:
That's not what I'm seeing.
You won't by default and with the current systemd unit file.
[Service]
Type=simple
That needs to be
Type=forking
Environment="UNITD_OPTIONS=--log /var/log/unit/unit.log --pid /var/run/unit/unit.pid"
ExecStart=/usr/sbin/unitd $UNITD_OPTIONS --no-daemon
You need to remove '--no-daemon'...
***@***.*** ~]$ cat /var/www/my_project/app/config.json
{
"listeners": {
"*:80": {
"pass": "applications/test"
}
},
"applications": {
"test": {
"type": "python 3.6",
"working_directory": "/var/www/my_project/app",
"path": "/var/www/my_project/app",
"home": "/var/www/my_project/venv",
"module": "app",
"callable": "app",
"user": "opc",
"group": "opc",
"protocol": "wsgi"
}
}
}
You don't seem to have stdout or stderr set...
|
Thank you for detailing how to configure Personally, I'm trying to direct both I'm also curious if there is a technical advantage to separating the two streams by default in For context, on the Nginx Slack community, I brought up Apache's mod_wsgi's previous default behavior of ignoring WSGI apps' Thank you. |
Have you tried this configuration... In
And in your unit application section "stdout": "/dev/stdout",
"stderr": "/dev/stderr"
IIRC
|
I have. Unfortunately I can get |
Without "stdout": "/dev/stdout",
"stderr": "/dev/stderr" Where does stdout/stderr go? |
Closes: nginx#147 Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Closes: #147 Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Closes: #147 Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
@ac000 did the documentation changes address this ticket or is there is still more to do? What is the acceptance criteria? |
I think we can close this for now... |
When explaining the
stderr
andstdout
options, https://unit.nginx.org/configuration/#applications mentions thatThis is misleading because only stderr is redirected. stdout still defaults to /dev/null and cannot be redirected when using
--no-daemon
mode.Fixing that is a separate issue (nginx/unit#1178) but for now the docs should be clearer.
The text was updated successfully, but these errors were encountered: