aboutsummaryrefslogtreecommitdiffstats
path: root/src/vty/logging_vty.c
AgeCommit message (Collapse)AuthorFilesLines
2024-06-05logging: add 'logging timezone (localtime|utc)'Neels Hofmeyr1-0/+28
Add ability to print logging timestamps in UTC. I want to test logging timestamps in vty transcript tests. To get deterministic timestamps, I can use osmo_gettimeofday_override(). However, so far we log in the server's local time zone: the dates printed after osmo_gettimeofday_override() still change according to the locally configured timezone -- not good for regression testing. For UTC, it is always the same. The intended use is for regression testing of timestamps, but maybe logging in UTC may be useful to some user out there, too. Change-Id: I7f868b47bf8f8dfcf85e735f490ae69b18111af4
2024-06-05logging: add timestamp fmt 'date' = 2018-01-16,01:44:34.681Neels Hofmeyr1-1/+2
Add 'date' to 'logging print timestamp (none|date|date-packed|ctime)' The idea is to have these date formats: date 2018-01-16,01:44:34.681 (new, "best" format) date-packed 20180116014434681 (current 'print extended-timestamp 1') ctime Sun Jan 1 01:44:34 2018 (current 'timestamp 1') Rationale: when reading log files, it can be important to see milliseconds precision on the timestamps. But the current extended-timestamp format lacks all separators, reading these manually is a pain. My eyes aren't good at counting digits, I keep getting the minutes, seconds and millis wrong and waste my time on every glance. So provide a new detailed timestamp format that is easier to read. Change-Id: Icbd5192ea835e24b12fe057cc1ab56e9572d75c0
2024-06-05logging vty: add 'logging print timestamp', deprecate other timestamp cmdsNeels Hofmeyr1-17/+42
Deprecate previous logging timestamp config commands: logging timestamp (0|1) logging print extended-timestamp (0|1) Add new single timestamp configuration command: logging print timestamp (none|date-packed|ctime) Another format called 'date' is added in patch Icbd5192ea835e24b12fe057cc1ab56e9572d75c0. The idea is to have these date formats: date 2018-01-16,01:44:34.681 (new, "best" format) date-packed 20180116014434681 (current 'print extended-timestamp 1') ctime Sun Jan 1 01:44:34 2018 (current 'timestamp 1') Change-Id: I58c792dda3cbcf8618648ba4429c27fa398a9e15
2024-06-05logging: use enum to set timestamp formatNeels Hofmeyr1-7/+15
In preparation of adding a new timestamp format, refactor to use an enum to pick the timestamp style. Introduce log_set_print_timestamp2() to be able to pass an enum value directly (for future additions). Deprecate previous API of log_set_print_timestamp() and log_set_print_extended_timestamp(). Remove the old members of struct log_target members: - print_timestamp and - print_ext_timestamp (bool flags), instead add member - timestamp_format (enum). This is an API and ABI incompatibility. (An original patch version preserved the unused struct members, but code review suggested it makes more sense to drop them.) The old API functions log_set_print_timestamp() and log_set_print_extended_timestamp() still work, but setting log_set_print_*timestamp(0) changes its behavior: now passing zero to either of these functions sets LOG_TIMESTAMP_NONE, so it now always switches off all timestamps, instead of previously maybe going back to another timestamp depending on the other flag being set or not. Change-Id: I70ecee543c266df54191d3e86401466cd1a5c0a6
2024-06-05logging_vty.c: rename static functionNeels Hofmeyr1-4/+4
Rename 'logging_prnt_timestamp_cmd' to logging_timestamp_cmd to better match its VTY name: 'logging timestamp (0|1)' (An actual 'logging print timestamp' command will be added in subsequent patch I58c792dda3cbcf8618648ba4429c27fa398a9e15, so clarify.) Change-Id: I5a651e393bd438ea236659ed2c86188a8f9885d1
2024-06-05formalize log subsys stripping for vtyNeels Hofmeyr1-4/+3
In osmocom, we historically have a leading 'D' in all of our logging subsystem names -- not only in the enum entry name, but also as the string in struct log_info_cat[]. As a result of this, our logging_vty code strips away the first character of each logging subsystem name. In the VTY, we don't enter 'dmain', but only 'main' -- the VTY strips the 'D' from "DMAIN". The intention is to make this stripping behavior optional in a subsequent patch. So far the code to do that is a magic "+ 1" thrown in here and there. Instead, introduce log_subsys_name() and use it where ever logging_vty.c does removal of the leading 'D'. I would have liked to keep this within logging_vty.c, but unfortunately it needs to be public API in logging.h, because of log_parse_category() which also strips leading D and lives in logging.c. Change-Id: I5f81343e8c7b714a4630e64ba654e391435c4244
2024-03-20Revert "Revert "logging: add log level cache""Hoernchen1-0/+7
This reverts commit 7f1fb3ea817578f3f2f63e8065aa50f8355caa3b - slightly amended with the new log_cache_enalbe() function. The cache is hence disabled by default, and applications can enable it, if they wish to benefit from it. Reason for the original revert was: some fallout expected due to log manipulation in test code Change-Id: I539872fc9e3c50b407e6bc388f1e091fa2c826c3
2024-01-09Revert "logging: add log level cache"Hoernchen1-7/+0
This reverts commit 7dc6d4a629a37bb081d62f6ce61f4e5ee0237247. Reason for revert: other tests are failing Change-Id: Ife4c49d1bb933e983ac68c57970c9c49b40e08be
2024-01-09logging: add log level cacheEric1-0/+7
This ensures multithreaded logging attempts, in particular ones that do nothing, do not hold the lock just for checking the level, which interferes with other logging attempts. Closes: OS#5818 Change-Id: I35f8dd9127dd6e7feae392094fd6b3ce2d32558d
2023-01-18Fix all references to config.hPau Espin Pedrol1-1/+1
config.h is created in $(top_buildir)/config.h. Let's make sure all CPPFLAGS add correct -Ipath includes, and that all code includes the correct file. Change-Id: Ie9ea38bb009bc715b01cde4d66d181f7bec2e7bd
2022-11-03Support building with -Werror=strict-prototypes / -Werror=old-style-definitionHarald Welte1-1/+1
Unfortunately "-std=c99" is not sufficient to make gcc ignore code that uses constructs of earlier C standards, which were abandoned in C99. See https://lwn.net/ml/fedora-devel/Y1kvF35WozzGBpc8@redhat.com/ for some related discussion. Change-Id: I84fd99442d0cc400fa562fa33623c142649230e2
2022-01-05VTY: implement 'no log gsmtap [HOSTNAME]' commandVadim Yanitskiy1-0/+22
Change-Id: I9a4efa1e35cbc22cea06a64a15a369522c32d3c4
2021-12-14treewide: remove FSF addressOliver Smith1-4/+0
Remove the paragraph about writing to the Free Software Foundation's mailing address. The FSF has changed addresses in the past, and may do so again. In 2021 this is not useful, let's rather have a bit less boilerplate at the start of source files. Change-Id: I5050285e75cf120407a1d883e99b3c4bcae8ffd7
2021-10-26logging: Change stderr + file target to use non-blocking writeHarald Welte1-7/+25
So far, we used blocking, buffered fwrite() to write to stderr and file targets. This causes problems if there are [slow] consumers causing delays, such as gnome-terminal (when the program is started interactively) or systemd/journald (where we observe 64..128ms blocks on stderr). This patch introduces stderr/file based logging via write_queue and osmo_select_main(), i.e. switch from glibc-buffered, blocking to internally buffered, non-blocking writes. * when osmo_stderr_target is created via application.c, we create it in blocking stream mode for backwards compatibility, particularly for [smaller] programs that don't use osmo_select_main() * when the VTY code encounters 'log stderr' or 'log file FILENAME', we switch that respective target to non-blocking write-queue mode, as this means the application is in fact using osmo_select_main() * The config file can now state 'log stderr blocking-io' or 'log file FILENAME blocking-io' to explicitly enforce using blocking stream based I/O * The application can at any time use API functions to switch either way Closes: OS#4311 Change-Id: Ia58fd78535c41b3da3aeb7733aadc785ace610da
2021-04-12vty/logging: logp: properly handle library specific sub-systemsVadim Yanitskiy1-0/+17
The library specific sub-systems are kind of special, because their position in the 'osmo_log_info' may vary depending on the number of application specific sub-systems. This is why their associated constant values (like DLGLOBAL) are negative, and this is what the LOGP() macro expects as the first argument. Before this change, invoking 'logp' command with any library specific logging sub-system would result in getting messages printed with the fall-back DLGLOBAL sub-systems. Change-Id: If86563e169fe1243adfa7b09c9d65d9f88c8a99e
2021-04-07vty/logging: ensure consistent '%' prefix for warningsVadim Yanitskiy1-6/+6
Change-Id: I2b2bab61e46668c3b4b0ccad88d02b6d00a83544
2021-04-07vty/logging: use consistent quiting in warning messagesVadim Yanitskiy1-4/+4
Change-Id: Ifded63a38caac26e174fc6cb69dead7bc83db344
2021-02-19logging: Allow prefixing thread ID to each log linePau Espin Pedrol1-0/+20
Related: OS#5032 Change-Id: I38fc93ab0182b4edbd639c7ed0f31ce51964ee18
2021-01-21logging_vty: Fix saving of "logging print file .. last"Harald Welte1-1/+2
Back in 2018 in I393907b3c9e0cc1145e102328adad0a83ee13a9f Neels introduced "last" as an optional flag to log the file/line number at the end of the line, rather than at the end of the header. It seems nobody has been usingi this feature, or at least never tried to save a related config file, as there was no code whatsoever that would ever save this optional "last" flag. Change-Id: I7b6245256aecc425722242aaabc154ac58ba27a0
2020-10-19logging: introduce 'systemd-journal' targetVadim Yanitskiy1-0/+65
This change implements 'systemd-journal' logging target, that is similar to the existing 'syslog' target. The key difference is that 'systemd-journal' allows us to offload rendering of the meta information, such as location (file name, line number), subsystem, and logging level, to systemd. Moreover, we can attach arbitrary, user-specific fields [1] to the logging messages, so they can be used for advanced log filtering (e.g. by IMSI/TMSI/TLLI): $ journalctl OSMO_SUBSYS=DMSC -f Since we don't want to make libsystemd a required dependency, this feature is optional, and needs to be enabled at build-time: $ ./configure --enable-systemd-logging The new logging target can be configured in the same way as any other one - via the VTY interface, or using the configuration file: log systemd-journal [raw] logging level set-all notice logging filter all 1 Two logging handlers are available: generic and raw. The first one behaves similarly to both 'syslog' and 'stderr', i.e. all the meta information is rendered by libosmocore itself, and then passed to systemd together with the logging message. The later is more like the 'gsmtap' target, so all available meta information is handed over to systemd in form of fields [1]: - CODE_FILE / CODE_LINE - location info, - PRIORITY - syslog-compatible logging level, - OSMO_SUBSYS - Osmocom-specific sub-system (e.g. DMSC), - OSMO_SUBSYS_HEX - same as OSMO_SUBSYS, but encoded in hex, - MESSAGE - the logging message itself, and then can be rendered in any supported format (e.g. JSON). More details about the API can be found in [2]. [1] https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html [2] https://www.freedesktop.org/software/systemd/man/sd-journal.html Change-Id: I609f5cf438e6ad9038d8fc95f00add6aac29fb23
2020-10-06vty: use install_lib_element() and install_lib_element_ve()Vadim Yanitskiy1-49/+49
See https://lists.osmocom.org/pipermail/openbsc/2020-October/013278.html. Change-Id: Ic541126ffd4975daf87199abfafb465e2055e44f Related: SYS#4937
2020-09-29logging_vty: set osmo_stderr_target to NULL on "no log stderr"Harald Welte1-0/+2
We cannot keep a reference to the old log_target around if we just destroyed/deleted it. Change-Id: I98a801cf83347a4422534d020d5ed5e2d1eb5482
2020-07-15vty: Avoid ultra-long multi-line strings cluttering talloc reportsHarald Welte1-0/+6
The talloc_asprintf() series includes an unconditional call to talloc_set_name_const(), turning the entire long constructed string into the name of the talloc object. That simply doesn't work when creating kilobytes-sized VTY reference strings including linefeeds. Let's add an explicit talloc_set_name_const() to prevent this. Change-Id: Ibd77684b88cc3572047daa98c9a6b9119fba041b Closes: OS#4668
2020-01-03logging_vty.c: Avoid acquiring log tgt lock in logging level cmd when not neededPau Espin Pedrol1-4/+4
Change-Id: Ia6780221174070cee408625e24513f2c11cc9dfc
2019-11-21logging/vty: fix: actually ignore deprecated logging commandsVadim Yanitskiy1-1/+1
We shall not prevent programs from starting if their configuration files contain deprecated 'logging level ...' commands. Just print a warning and return CMD_SUCCESS instead of CMD_WARNING. While writing a unit test, another funny bug has been uncovered. Parsing of a deprecated command indeed triggers a deprecation warning, originated from libosmovty's log_deprecated_func(). This function simply calls vty_out(), but... Since the invocation of the vty_out() happens _before_ the VTY is initialized, the process is actually writing that warning to its own stdin! Most likely, because we use talloc_zero() to allocate a new instance of struct 'vty'. As a side effect, the evil warning magically appears in the output of 'make check', breaking the test statistics. Let's work around this bug for now by redirecting stdin to /dev/null. Change-Id: Ia934581410cd41594791d4e14ee74c16abe1009a Fixes: Ic9c1b566ec4a459f03e6319cf369691903cf9d00
2019-11-21logging/vty: use LOG_LEVEL_ARGS in logging_vty_add_deprecated_subsys()Vadim Yanitskiy1-2/+1
Change-Id: I862c3cce0147ee8cf4013501132584ea09c58b53
2019-11-20logging/vty: do not print deprecated logging commands to stdoutVadim Yanitskiy1-1/+0
Yes, we don't really need to poison stdout, as some osmo-* binaries (like osmo-gapk) may want to use it for non-logging purposes. This printf() call looks like a debugging leftover. Change-Id: Ida35865b1c0bb3d3567918f8e89c6551c6b34103
2019-10-09logging: Introduce mutex API to manage log_target in multi-thread envsPau Espin Pedrol1-88/+113
log_enable_multithread() enables use of locks inside the implementation. Lock use is disabled by default, this way only multi-thread processes need to enable it and suffer related complexity/performance penalties. Locks are required around osmo_log_target_list and items inside it, since targets can be used, modified and deleted by different threads concurrently (for instance, user writing "logging disable" in VTY while another thread is willing to write into that target). Multithread apps and libraries aiming at being used in multithread apps should update their code to use the locks introduced here when containing code iterating over osmo_log_target_list explictly or implicitly by obtaining a log_target (eg. osmo_log_vty2tgt()). Related: OS#4088 Change-Id: Id7711893b34263baacac6caf4d489467053131bb
2019-08-20vty: Register logp cmd next to logging commandsPau Espin Pedrol1-2/+3
This way it's easier by osmo_verify_transcript_vty.py to skip and avoid breaking existent test in osmo-hlr. Fixes: d0b3b9edac978c91bf84aa2537aa24426685b1fb Change-Id: Iab9423661e4f4eefca2e3d02b60a43f913ed92a3
2019-08-13add vty logp command to echo on all log targetsNeels Hofmeyr1-0/+41
When reading SUT logs resulting from TTCN3 runs, it can be hard to figure out which log section corresponds to which test code. Add a 'logp' command on VIEW and ENABLE nodes that simply echos an arbitrary message on log output, useful to set markers / explanations from the TTCN3 code, which then appear in all log outputs and can make it trivial to figure out which log section is interesting. logging_vty_test# logp lglobal notice This is the log message DLGLOBAL NOTICE This is the log message From TTCN3, could be used like this, e.g. in BSC_Tests.ttcn: private function f_logp(charstring log_msg) runs on MSC_ConnHdlr { // log on TTCN3 log output log(log_msg); // log in stderr log f_vty_transceive(BSCVTY, "logp lglobal notice " & log_msg); } ... f_logp("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); Change-Id: Ife5dc8999174c74e0d133729284fe526d6eaf8d9
2019-08-02Get rid of osmo_str_tolower() use inside libosmocore codePau Espin Pedrol1-11/+13
There's no real good reason for using that function (static buffer) instead of osmo_str_tolower_buf(local buffer), so let's use the later. In any case, we get rid of TLS variables in those places, which is a performance improvement. It will also allow later shrinking of those buffers if we decide to define maximum logging category and level name length. Change-Id: I2e99de1142020e4d80ef0a094e4e751f7903f5f9
2019-07-30vty/logging_vty.c: fix writing of 'print category-hex'Vadim Yanitskiy1-0/+2
Change-Id: I33837f0fac1afe83596fa600916abc05ecb8c356
2018-10-01vty logging: fix crash when missing 'logging enable'Neels Hofmeyr1-0/+8
We must explicitly check the return value of osmo_log_vty2tgt(), or may run into a segfault. I wasn't aware of this and introduced numerous such cases in I36f17c131cc70ce5a1aef62fd9693097de230cd4. Reproduce: on the VTY, do not issue 'logging enable', invoke 'logging level force-all LEVEL' first. Show in logging_vty_test.vty that this situation is now again amended by telling the user that logging was not enabled. Related: OS#3611 Change-Id: Id11702d1801d6654ca5e5a51b597a0d802e2e8dd
2018-09-25logging_vty: Ensure writing well-formed config filesHarald Welte1-9/+9
We want to have well-formed config files that print exactly one space per VTY/config node level, and not two. Change-Id: Ia75c7067284ea225cffe13ca71bad05a7747ae66
2018-09-16logging vty: add 'logging level set-all <level>'Neels Hofmeyr1-0/+24
Add new command to once-off set each and every category to the given log level, as discussed at length on the openbsc@ mailing list. Show that it works in logging_vty_test.vty. Change-Id: I4c3e4f786476cb813fdc0a7c64f30ee04758309d
2018-09-13logging vty: deprecate 'all', introduce 'force-all'Neels Hofmeyr1-20/+57
Add 'logging level force-all <level>' and 'no logging level force-all' as new names for 'logging level all <level>' and 'logging level all everything'. Resurrect the functionality of 'logging level all everything' -- even if it is still deprecated because the name is confusing, it is now just an alias for 'no logging level force-all'. Show in logging_vty_test.vty that we can now again lift the global logging clamp, both with the new commands as well as with the deprecated ones. Also show that 'force-all' is written back properly, if set. Change-Id: I36f17c131cc70ce5a1aef62fd9693097de230cd4
2018-09-13logging vty: write: check logging levels validityNeels Hofmeyr1-7/+23
Change-Id: If683b1272ad2d5b402b91c52c496aa7975bc6315
2018-09-13logging vty: deprecate the 'everything' keywordNeels Hofmeyr1-12/+22
The 'logging level all everything' has not had an effect for some time now. The plan is to bring back its old functionality, but to keep it deprecated and rather define a less confusing name. * Deprecate 'everything'. * Do not write 'everything' during 'write file' or 'show running-config', which we curiously still do until now. BTW, the reason why we need to compose a complete list of categories for the deprecated 'everything' command is explained in detail in the commit log for I3b083f27e3d751ccec258880ae7676e9af959a63 Change-Id: Ib75fedb0572570a61bb34ee729a2af86cf5f16da
2018-09-13logging vty: rewrite 'logging level' vty cmd generationNeels Hofmeyr1-6/+61
Completely drop the implementations of log_vty_command_{str,description}(). These functions have been public API once, marked as deprecated since c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7 (March 2017). I considered to keep them, or reduce them to useless stubs, but it is quite silly, really. These functions are completely and utterly useless outside of libosmocore. Any program linking these deserves to fail. Re-implement vty logging level command gen, in logging_vty.c. logging.c is simply the wrong place for that. Introduce logging_internal.h to share logging definitions to logging_vty.c without publishing as API. Introduce static gen_logging_level_cmd_strs() to compose a list of category arguments with their descriptions for VTY commands. Use osmo_talloc_asprintf() instead of the previous error prone and chaotic strlen() counting method. Do not dynamically generate log level arguments, just keep static strings. We are super unlikely to ever change the log levels we have. No changes in logging_vty_test.vty: proves that there is no functional change. All of this, besides introducing basic sanity, is cosmetic preparation to be able to re-use the generic command generation code for arbitrary commands with category or level args (for deprecated and new keywords). Rationale: I want to hide 'all' and 'everything' from the VTY command documentation, by means of deprecating. I first tried to simply define a deprecated 'logging level CAT everything' command: logging level (all|rsl|rr|...) (debug|info|notice|error|fatal) logging level CAT everything # <- deprecated and hidden But unfortunately, command matching doesn't work as intended when the CAT argument reflects a valid category; I want it to invoke the deprecated function as soon as the 'everything' keyword follows, but it stays stuck to the "valid" command when the category argument matches an explicit keyword in that list, and will throw an error on the following 'everything' keyword. I.e.: logging level rsl everything % Unknown command # <-- leads to config file parse error logging level unknown_string everything % Ignoring deprecated 'everything' # <-- works only for invalid categories So I need to define 'everything' separately, again with a list of each valid category instead of a generic CAT arg. Change-Id: I3b083f27e3d751ccec258880ae7676e9af959a63
2018-09-07add osmo_str_tolower() and _toupper() with testNeels Hofmeyr1-7/+4
We already have osmo_str2lower() and osmo_str2upper(), but these lack: * proper destination buffer bounds checking, * ability to call directly as printf() argument. Deprecate osmo_str2upper() and osmo_str2lower() because of missing bounds checking. Introduce osmo_str_tolower_buf(), osmo_str_toupper_buf() to provide bounds-safe conversion, also able to safely convert a buffer in-place. Introduce osmo_str_tolower(), osmo_str_toupper() that call the above _buf() equivalents using a static buffer[128] and returning the resulting string directly, convenient for direct printing. Possibly truncated but always safe. Add unit tests to utils_test.c. Replace all libosmocore uses of now deprecated osmo_str2lower(). Naming: the ctype.h API is called tolower() and toupper(), so just prepend 'osmo_str_' and don't separate 'to_lower'. Change-Id: Ib0ee1206b9f31d7ba25c31f8008119ac55440797
2018-08-27log: add 'last' option to 'logging print file'Neels Hofmeyr1-2/+8
Allow printing the source file information *after* the log information. Add target->print_filename_pos, log_set_print_filename_pos() and enum log_filename_pos, and the optional 'last' keyword to the 'logging print file' vty command. (An enum in case we want to add other positions later.) Rationale: on log lines, the logging context is usually printed first in the logging text. Without the source file information, this logging context pretty much aligns in an easily readable way. When adding the source file information, each line's logging context info is shifted right by a pretty much random amount and it is hard to spot recurring logging contexts. One solution is to switch off source file info, of course, but that's not an option when actively hacking on bugs and new features. For example, it is unnecessarily hard to spot lchan FSM related log lines in this osmo-bsc log snippet: DRSL NOTICE mgw_endpoint_fsm.c:603 mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Freeing instance DRSL NOTICE fsm.c:381 mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Deallocated DMSC NOTICE mgw_endpoint_fsm.c:603 SUBSCR_CONN(conn0){CLEARING}: Received Event FORGET_MGW_ENDPOINT DCHAN DEBUG lchan_rtp_fsm.c:741 lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED DCHAN DEBUG lchan_rtp_fsm.c:520 lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Freeing instance DCHAN DEBUG fsm.c:381 lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Deallocated DCHAN DEBUG lchan_rtp_fsm.c:520 lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED DCHAN DEBUG lchan_fsm.c:1232 lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: state_chg to WAIT_RF_RELEASE_ACK DRSL NOTICE handover_fsm.c:762 handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Terminating (cause = OSMO_FSM_TERM_REGULAR) DRSL NOTICE handover_fsm.c:762 handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Freeing instance DRSL NOTICE fsm.c:381 handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Deallocated DCHAN DEBUG lchan_fsm.c:1196 lchan(0-0-1-TCH_F-0){WAIT_RF_RELEASE_ACK}: state_chg to BORKEN DCHAN DEBUG lchan_fsm.c:354 lchan(0-0-1-TCH_F-0){BORKEN}: (type=TCH_F) Clearing lchan state DLMGCP DEBUG mgcp_client.c:741 Tx MGCP msg to MGCP GW: 'DLCX 3 2@mgw MGCP 1.0' DLMGCP DEBUG mgcp_client.c:743 Sending msg to MGCP GW size: 66 DRLL NOTICE mgcp_client_fsm.c:422 MGCP_CONN(to-BTS){ST_DLCX_RESP}: Received Event EV_DLCX_RESP Placing the source file info behind the log text makes it much easier to follow, while the source file info is still available: DRSL NOTICE mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Freeing instance (mgw_endpoint_fsm.c:603) DRSL NOTICE mgw-endpoint(conn0){WAIT_MGW_RESPONSE}: Deallocated (fsm.c:381) DMSC NOTICE SUBSCR_CONN(conn0){CLEARING}: Received Event FORGET_MGW_ENDPOINT (mgw_endpoint_fsm.c:603) DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED (lchan_rtp_fsm.c:741) DCHAN DEBUG lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Freeing instance (lchan_rtp_fsm.c:520) DCHAN DEBUG lchan_rtp(0-0-1-TCH_F-0){ROLLBACK}: Deallocated (fsm.c:381) DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: Received Event LCHAN_EV_RTP_RELEASED (lchan_rtp_fsm.c:520) DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RLL_RTP_ESTABLISH}: state_chg to WAIT_RF_RELEASE_ACK (lchan_fsm.c:1232) DRSL NOTICE handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Terminating (cause = OSMO_FSM_TERM_REGULAR) (handover_fsm.c:745) DRSL NOTICE handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Freeing instance (handover_fsm.c:745) DRSL NOTICE handover(interBSCin_conn0){WAIT_RR_HO_DETECT}: Deallocated (fsm.c:381) DCHAN DEBUG lchan(0-0-1-TCH_F-0){WAIT_RF_RELEASE_ACK}: state_chg to BORKEN (lchan_fsm.c:1196) DCHAN DEBUG lchan(0-0-1-TCH_F-0){BORKEN}: (type=TCH_F) Clearing lchan state (lchan_fsm.c:354) DLMGCP DEBUG Tx MGCP msg to MGCP GW: 'DLCX 3 12@mgw MGCP 1.0' (mgcp_client.c:741) DLMGCP DEBUG Sending msg to MGCP GW size: 67 (mgcp_client.c:743) DRLL NOTICE MGCP_CONN(to-BTS){ST_DLCX_RESP}: Received Event EV_DLCX_RESP (mgcp_client_fsm.c:422) Implementation: for 'last', insert source file info only when an '\n' is found at the end of the log line composition buffer, so that LOGP()...LOGPC() constructs also print source file info only when a log line actually ends. Change-Id: I393907b3c9e0cc1145e102328adad0a83ee13a9f
2018-07-25logging_vty: Simplify code in config_write_log_singlePau Espin Pedrol1-7/+1
Since we ignore "logging level CAT everything" in logging_level_cmd, we can never run into the case in which we have loglevel==EVERYTHING, so we can simplify this code and make it esier for later removal of everything keyword. Change-Id: I4e76c65a11cc22616c6dfc632435617ebb861c03
2018-06-09vty: Add logging_vty_add_deprecated_subsysHarald Welte1-0/+21
This function permits the user to register deprecated log categories, which will ensure that if log categories are removed from a program, old config files will still load. We simply dynamically allocate a cmd_element and install it at CFG_LOG_NODE. Not registering it at VIEW_NODE or ENABLE_NODE ensures that it's not accessible from the interactive VTY, but only from the config file / configure node. Change-Id: I171f62ea2dc565b3a6c3eecd27fb7853e2529598
2018-02-06vty: fix 'logging print file' outputNeels Hofmeyr1-8/+11
In If1bd79026a3c680ccf7587d545d12f7759a998fc, an erratic logging output crept in for an earlier patch state and was merged by accident; fix 'logging print file (0|1|basename)' output. Add value string to map LOG_FILENAME_* enum to VTY args, use for both command evaluation as well as printing the vty config. The default is 'logging print file 1', hence we could omit an output when '1' is chosen. But for clarity, always output the current setting. Change-Id: I1c931bff1f1723aa82bead9dfe548e4cc5b685e0
2018-01-19logging vty: add 'logging print file (0|1|basename)' cmdNeels Hofmeyr1-0/+27
Add a VTY command that allows configuring the output of source filename. So far, this was not configurable by VTY at all. Change-Id: If1bd79026a3c680ccf7587d545d12f7759a998fc
2018-01-19logging: separate the '<000b>' subsys from filename loggingNeels Hofmeyr1-0/+19
Add a separate flag and API to switch the category-in-hex output: log_set_print_category_hex(). Add log_set_print_filename2() to modify only the print_filename flag. The old log_set_print_filename() function still affects both flags. Explain the rationale in the comment for log_set_print_filename(). There is no need to deprecate log_set_print_filename(); it might cause compiler warnings and break strict builds unnecessarily. Add VTY command 'logging print category-hex (0|1)'. Since there is no VTY command to switch filename output, nothing needs to be adjusted there (a command will be added in a subsequent patch). Change-Id: Iba03a2b7915853c6dccaf6c393c31405320538b4
2018-01-17logging: add ability to log the log-level with API and vtyNeels Hofmeyr1-0/+21
Log the log level string after the category name, if enabled. The default behavior remains unchanged. Change-Id: Ie6be365cfa6aeabdf115bff19bac198440c9adf1
2018-01-05Use 127.0.0.1 for GSMTAP logging by defaultMax1-3/+3
Previously the were no default value provided in case of unspecified hostname in "log gsmtap" vty config. This leads to confusing log messages because NULL was used as a hostname: Inconsistent indentation -- leading whitespace must match adjacent lines, and indentation must reflect child node levels. A mix of tabs and spaces is allowed, but their sequence must not change within a child block. Fix this by using 127.0.0.1 as default log destination and logging hostname in case of errors. Related: OS#2608 Change-Id: I58b1d4ec522af18024be2e56c9103b3db7936813
2017-12-12logging vty: describe 'logging set-log-mask' command, add OSMO_STRINGIFY_VAL()Neels Hofmeyr1-2/+11
Change-Id: I73ac5873ede858da44e1486d8a5c81da1ed5b19f
2017-11-13Fix/Update copyright notices; Add SPDX annotationHarald Welte1-0/+2
Let's fix some erroneous/accidential references to wrong license, update copyright information where applicable and introduce a SPDX-License-Identifier to all files. Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af