Skip to content
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

luci-base: err log class for non-err messages #7315

Open
systemcrash opened this issue Oct 8, 2024 · 5 comments
Open

luci-base: err log class for non-err messages #7315

systemcrash opened this issue Oct 8, 2024 · 5 comments

Comments

@systemcrash
Copy link
Contributor

ping @jow-

Steps to reproduce:

  1. go to: Syslog
  2. observe daemon.err log lines like:
Tue Oct  8 18:10:07 2024 daemon.err uhttpd[2772]: [info] luci: accepted login on /admin/blah for root from x.x.x.x

This appears due to dispatch.uc which has:

function syslog(prio, msg) {
	warn(sprintf("[%s] %s\n", prio, msg));
}

So we get daemon.err despite the message electing the info log class. Can this be improved?

Expected behavior:

Correct log class for syslog messages from uhttpd.

Additional Information:

OpenWrt version information from system /etc/openwrt_release

DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='23.05.5'
DISTRIB_REVISION='r24106-10cc5fcd00'
DISTRIB_TARGET='x86/64'
DISTRIB_ARCH='x86_64'
DISTRIB_DESCRIPTION='OpenWrt 23.05.5 r24106-10cc5fcd00'
DISTRIB_TAINTS=''
@systemcrash systemcrash changed the title luci-base: luci-base: err log class for non-err messages Oct 8, 2024
@jow-
Copy link
Contributor

jow- commented Oct 8, 2024

Make it printf() instead of warn(sprintf()). Should probably decide based on prio.

@systemcrash
Copy link
Contributor Author

That was one of the first things I tried but nothing is then emitted to the syslog. 😒

I thought you would know better what to try after that.

@systemcrash
Copy link
Contributor Author

I'll try printf, maybe I just tried sprintf.

@systemcrash
Copy link
Contributor Author

No - those don't seem to emit anything. 🤷

@jow-
Copy link
Contributor

jow- commented Oct 9, 2024

Yeah, I recall. It's because procd captures uhttpd's stderr and relays it as daemon.err which is where LuCI's warn() output ends up. stdout is reserved for cgi communication. Not solvable unless you invest time implementing a full blown syslog() binding (some effort) or invoking the external logger util (overhead).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants