#5 Add a quiet mode for logging

closed
nobody
None
5
2008-10-29
2007-09-02
Bill sharer
No

I'm currently using acpid on an HP Turion ML40 based laptop under gentoo as the acpid-1.0.6 ebuild. This uses the apcid-1.0.6.tar.gz tarball as is without any patches.

I'm not sure if this is a quirk of the ML40, but acpid handles a CPU0 processor event on the order of one every second or more. This results in about 3 LOG_INFO level messages going to the syslog, and the current software doesn't allow the logging level to be turned off or tuned.

The resulting datastorm rapidly fills both /var/log/syslog and /var/log/messages and prevents any sort of battery mode conservation by spinning down the hard drive.

I've hacked my config as follows in order to provide a new q switch for quiet mode that only logs LOG_NOTICE or lower when enabled. I've also changed a couple of logging calls from LOG_INFO to LOG_NOTICE so that they would still appear. Logging runs as before if the switch is not supplied on startup.

I actually think that LOG_INFO level reports from events should be removed in favor of having the user do something with the triggers and scripts in /etc/acpid instead, but I guess you wouldn't see what a CLIENT may be up to.

----------------------

diffs to acpid.c

58a59
> static int quiet = 0;
161c162,163
< acpid_log(LOG_INFO, "starting up\n");
---
> acpid_log(LOG_NOTICE, "starting up\n");
> if (quiet) acpid_log(LOG_NOTICE, "starting in quiet mode\n");
272a275
> {"quiet", 0, 0, 'q'},
297c300
< i = getopt_long(*argc, *argv, "c:de:fg:m:s:Svh", opts, NULL);
---
> i = getopt_long(*argc, *argv, "c:de:fg:m:q:s:Svh", opts, NULL);
320a324,326
> case 'q':
> quiet = 1;
> break;
456c462,463
< vsyslog(level, fmt, args);
---
> if ((level < LOG_INFO) || (!quiet))
> vsyslog(level, fmt, args);

------------------

diffs to event.c

157c157
< acpid_log(LOG_INFO, "%d rule%s loaded\n",
---
> acpid_log(LOG_NOTICE, "%d rule%s loaded\n",
343c343
< acpid_log(LOG_INFO, "%d client rule%s loaded\n",
---
> acpid_log(LOG_NOTICE, "%d client rule%s loaded\n"

Discussion

  • Ted Felix

    Ted Felix - 2008-10-15

    Logging of events is off by default in the latest CVS version of the source (informally known as 1.0.7b1). This feature request can be closed as complete.

     
  • Tim Hockin

    Tim Hockin - 2008-10-29
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks