Commit Graph

56 Commits

Author SHA1 Message Date
Thomas Haller
6b5fb892e1 core/logging: when comparing glib log levels, ignore non-level flags
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-04 10:37:50 +02:00
Thomas Haller
48b4d0eaf2 core/logging: remove thread-safe initialization guard for nm_logging_syslog_openlog()
The logging routines are not thread-safe in general, so there is no
need for trying to make nm_logging_syslog_openlog() thread-safe.
Also nm_logging_syslog_openlog() is only called by the main() routine.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-06-02 16:08:02 +02:00
Thomas Haller
8e88b4e2fa core/logging: trivial renaming internal LOGD_OLPC_MESH name to LOGD_OLPC
The domain LOGD_OLPC_MESH is known as "OLPC". This is the only case where
the internal name LOGD_X does not correspond to the external name X.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-12 18:52:27 +02:00
Dan Winship
a4b8645a60 logging: use GLib's logging functions if not using syslog
If nm_logging_syslog_openlog() isn't called (ie, in the test
programs), then route nm_log() messages to g_log() rather than just
using fprintf().
2014-04-23 10:19:17 -04:00
Dan Winship
3b197de59f dispatcher: add better debugging
Add LOGD_DISPATCH, and if it's set to DEBUG, tell nm-dispatcher to log
additional information about each script it runs.
2014-04-18 11:33:15 -04:00
Thomas Haller
f0a8b3a76d core: fix alignment of logging timestamp
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-02-26 19:06:00 +01:00
Dan Winship
1d42962e7f logging: fix "nmcli gen log level FOO"
The change to per-domain log levels means that when setting just the
level, we need to re-set the log level for each domain (since it's the
"logging" bit array that actually determines what gets logged).
nm_logging_setup() was dealing correctly with domains=NULL, but not
domains="" (which is what happens when it is invoked with only a level
via D-Bus), so doing "nmcli gen log level DEBUG" would change the
"default" log level, but leave all of the domains still at their
previous level:

danw@laptop:NetworkManager> nmcli g log
LEVEL  DOMAINS
INFO   PLATFORM,RFKILL,ETHER,WIFI,BT,MB,DHCP4,DHCP6,PPP,IP4,IP6...

danw@laptop:NetworkManager> nmcli g log level DEBUG
danw@laptop:NetworkManager> nmcli g log
LEVEL  DOMAINS
DEBUG  PLATFORM:INFO,RFKILL:INFO,ETHER:INFO,WIFI:INFO,BT:INFO...
2014-01-22 09:48:42 -05:00
Dan Winship
32a12ad9a4 core: fix leak in impl_manager_get_logging
nm_logging_level_to_string() returned a const string, but
nm_logging_domains_to_string() returned a malloced one, which was
getting leaked in impl_manager_get_logging(). Fix this by making them
both malloced, and freeing as needed.
2013-12-20 10:04:11 -05:00
Thomas Haller
224e698904 logging: Use locale independent strcasecmp 2013-12-20 10:04:10 -05:00
Dan Winship
111603212c logging: ignore unrecognized domains on startup
If the command line or NetworkManager.conf mentions a non-existent
domain, just print a warning and ignore it. That way if you switch to
using an older NM that doesn't have that domain, it will still work.
2013-12-20 10:04:10 -05:00
Dan Winship
fc2a14d0f9 logging: allow per-domain log level overrides
Allow specifying log domains like "DEFAULT,WIFI:DEBUG" to override the
log level on a per-domain basis.
2013-12-20 10:04:10 -05:00
Dan Winship
0e3432fbea logging: tweak logging-enabled functions
Rather than having separate nm_logging_level_enabled() and
nm_logging_domain_enabled(), have just nm_logging_enabled() that
checks both.
2013-12-20 09:57:13 -05:00
Dan Williams
3e6906e773 logging: add DCB log domain 2013-10-31 13:29:21 -05:00
Dan Winship
52813b48c1 core: add LOGD_CONCHECK, log unexpected concheck responses at LOGL_INFO 2013-08-28 10:54:08 -04:00
Dan Winship
552ed76f59 core: make log domains 64-bit 2013-08-28 10:54:08 -04:00
Jiri Pirko
23836e8146 core: add support for team device
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:15 -05:00
Dan Williams
3c6d789c62 logging: add log domain for D-Bus PropertiesChanged signal stuff
Otherwise it really clutters up the CORE logging when debugging is
enabled.
2013-08-06 16:29:09 -05:00
Thomas Haller
a853b3bd23 core: minor code cleanup to use preprocessor constants
Use preprocessor constants in nm_logging_all_domains_to_string instead
of hard coded values for the special logging domain names.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-08-06 13:48:02 -05:00
Colin Walters
2269b708ac main+logging: Allow early logging before config files
The new setup phase goes like this:

- main()
- parse command line options
- logging is configured, targeting stdout/stderr
- ...other stuff...
- do or do not daemonize, depending on commandline option and config files
- Call openlog() - further log messages go to syslog (and potentially
  stderr as well, if the -d option was specified so we use LOG_PERROR).

Basically, this allows us to log messages about config file parsing
and such, which *greatly* helps with debugging.
2013-06-24 15:48:53 -05:00
Dan Winship
8d44136dce main: add --debug, fix logging under systemd
When run with --no-daemon, NM used to duplicate all syslog output to
stderr, for ease of debugging. But this meant it had to tell systemd
to ignore stderr, so you wouldn't get duplicated log entries. But that
meant we lost error messages that didn't go through nm_log. (eg,
g_warning()s and g_return_if_fail()s).

Fix this by making --no-daemon no longer duplicate syslog output to
stderr, and removing the "StandardError=null" from the systemd service
file. To get the old behavior, you can use --debug instead of
--no-daemon.

https://bugzilla.gnome.org/show_bug.cgi?id=700550
2013-05-21 09:30:09 -03:00
Dan Winship
8bb9ee8d3b config: fix documentation of --log-domains
The list of log domains in the --log-domains documentation had gotten
out of date. Fix this by adding nm_logging_all_domain_to_string()
(and, for completeness, nm_logging_all_levels_to_string()), and use
those to fill in the help string.
2013-04-03 10:23:47 -04:00
Dan Williams
fab66119dc logging: add BRIDGE log domain 2013-02-04 10:37:46 -06:00
Pavel Šimerda
1495853e01 logging: add LOGD_PLATFORM 2013-01-24 19:48:01 +01:00
Colin Walters
ae627737d5 Remove SIGSEGV/SIGFPE etc. handling
Modern operating systems come with systemwide "crash catching"
facilities; for example, the Linux kernel can now pipe core dumps out
to userspace, and programs like "systemd-coredump" and "abrt" record
these.

In this model, it's actively counterproductive for individual
processes to catch SIGSEGV because:

1) Trying to unwind from inside the process after arbitrary
   corruption is destined to fail.
2) It hides the fact that a crash happened at all - my OS test
   framework wants to know if any process crashed, and I don't
   want to guess by running regexps against /var/log/Xorg.0.log
   or whatever.

Signed-off-by: Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=692032
2013-01-22 12:49:48 -05:00
Jiří Klimeš
7b10b4d468 logging: add 'DEFAULT' logging domain
It contains logging domains that are active by default. It allows users
to set default domains back easily (after they changed them).

And fix formatting of "} else if".
2013-01-09 16:47:49 +01:00
Jiří Klimeš
1eb9c5e352 logging: add "VLAN" log domain 2012-11-07 13:58:47 +01:00
Jiří Klimeš
8437b07581 logging: add "BOND" log domain 2012-11-07 13:58:47 +01:00
Jiří Klimeš
8fbd24c9b4 logging: add new combined log domains
ALL  - for setting all log domains
DHCP - for DHCP4 combined with DHCP6
IP   - for IP4 combined with IP6
2012-11-07 13:58:47 +01:00
Dan Winship
a13d4e9d3d build: fix build after addition of new warnings 2012-08-01 09:48:03 -04:00
Pantelis Koukousoulas
d125296eb1 adsl: initial PPPoE support for ADSL devices 2012-05-18 15:42:56 -05:00
Dan Winship
839eab5564 Use glib-mkenums to generate enum types
Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.

Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.

Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.

To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.

Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
2012-02-15 11:42:15 -05:00
Peter Korsgaard
cbf72aeb34 core: only include execinfo.h if crashtrace support is enabled
On systems without backtrace suport (E.G. uClibc depending on config),
execinfo.h might not be available, breaking the build.

Fix it by only including it if enabled.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2012-01-05 11:50:28 -06:00
Dan Williams
b2eaf7228e firewall: add firewall log domain and use it in firewall code 2011-12-06 16:51:17 -06:00
Dan Winship
5366c3d6d4 wired: split NMDeviceWired out of NMDeviceEthernet and add NMDeviceInfiniband 2011-12-02 13:09:16 -06:00
David Rothlisberger
bcef119ffd build: add --disable-crashtrace option
Disables GNU backtrace extensions.
2011-10-05 17:01:16 -05:00
Dan Williams
6dae3c2f33 ppp: enable pppd debug logging when PPP log domain is enabled for debuggin
Instead of just with the old environment variable.  This means we'll
log pppd debug output when the log level is changed via the D-Bus
interface now too.
2011-05-19 13:31:52 -05:00
Dan Williams
e7be98260e logging: clean up logging macros and helper
There were two specific problems with the logging macros:

1) the existing varargs usage didn't allow for format string checking,
which is bad, since it could make logging segfault if the arguments
don't match the format string

2) it didn't allow logging usage without wrapping {}, ie this didn't work:

if (foo)
   nm_log_dbg (...)

blah blah

Fix all that by using the varargs stuff correctly.
2011-03-19 12:42:29 -05:00
Kjartan Maraas
6d0d302916 build: do the right thing with config.h (bgo #644664)
1) it shouldn't be included in headers
2) it should be the first thing included in source files
3) it's needed for getting translation right
2011-03-14 01:01:22 -05:00
Dan Williams
6d344a43e9 Merge remote-tracking branch 'origin/rm-userset'
There; it's merged.  Yay!
2011-02-12 22:51:12 -06:00
Ozan Çağlayan
9049358579 logging: don't print extraneous newline in syslog 2011-02-09 10:52:28 -06:00
Dan Williams
f9ceafd4a1 Merge remote branch 'origin/master' into rm-userset 2011-01-12 15:46:37 -06:00
Dan Williams
76c7d2f95c logging: add WiMAX log domain 2011-01-02 22:16:22 -06:00
Dan Williams
66291ec204 logging: LOGD_USER_SET -> LOGD_AGENTS 2010-12-10 12:36:02 -06:00
Dan Williams
cf7cc2492d logging: LOGD_SYS_SET -> LOGD_SETTINGS 2010-12-10 12:32:22 -06:00
Dan Williams
b9a919784e logging: add accessor for log level 2010-08-08 01:38:52 -05:00
Dan Williams
79df93ce33 logging: log PID with syslog messages 2010-05-04 15:03:59 -07:00
Dan Williams
defaee09e5 logging: correctly print new logging level and domains on changes
Previously the input would simply be printed, but if you're not
changing either the level or domains (ie sending "") then the
unchanged logging domains wouldn't be printed, only "".
2010-05-04 12:06:00 -07:00
Jiří Klimeš
9000c68839 logging: change default level to be true INFO level
Using LOGL_INFO | LOGL_WARN | LOGL_ERR as default to log the same values
as though "--log-level=INFO" were specified.
2010-04-12 17:55:44 +02:00
Dan Williams
78f7ef1115 logging: use INFO level for debug messages
By default most distros won't log debug messages to syslog; but we
want them logged when the user explicitly requests them via the logging
API and config options in NM.  Half the point of doing more logging
was to make it easier for users to get logs out of NM, and having
to edit syslog configuration makes it all pointless.
2010-04-08 14:49:56 -07:00
Dan Williams
0d8174dfa6 logging: fix build on 32-bit platforms 2010-04-08 13:29:07 -07:00