Project

General

Profile

Actions

Bug #969

open

It is not possible to only enable/disable events with '*' in their names

Added by Philippe Proulx about 9 years ago. Updated about 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
10/27/2015
Due date:
% Done:

0%

Estimated time:

Description

Some domains give great liberty regarding their logger names.

For example, Python's logging.getLogger() requires a simple string. It is thus possible to have the * character in the logger name:

import lttngust
import logging
import time

def hello():
    logger = logging.getLogger('hello*')
    logger2 = logging.getLogger('hello34')

    while True:
        logger.warn('hello from logger')
        logger2.warn('hello from logger2')
        time.sleep(0.1)

if __name__ == '__main__':
    hello()

Here, lttng list -p shows:

Python events (Logger name):
-------------------------

PID: 31194 - Name: python
      - hello*
      - hello34

In this context, it's not possible to enable the event named hello* without also enabling the one named hello34 because the * character in the event name, when enabling, is a wildcard:

lttng enable-event -p 'hello*'
lttng start
sleep .3
lttng stop
lttng view

This shows:

[19:41:56.916637271] (+?.?????????) archeepp lttng_python:event: { cpu_id = 1 }, { asctime = "2015-10-27 19:41:56,916", msg = "hello from logger", logger_name = "hello*", funcName = "hello", lineno = 12, int_loglevel = 30, thread = 615352064, threadName = "MainThread" }
[19:41:56.916863273] (+0.000226002) archeepp lttng_python:event: { cpu_id = 1 }, { asctime = "2015-10-27 19:41:56,916", msg = "hello from logger2", logger_name = "hello34", funcName = "hello", lineno = 13, int_loglevel = 30, thread = 615352064, threadName = "MainThread" }
[19:41:57.017339890] (+0.100476617) archeepp lttng_python:event: { cpu_id = 1 }, { asctime = "2015-10-27 19:41:57,017", msg = "hello from logger", logger_name = "hello*", funcName = "hello", lineno = 12, int_loglevel = 30, thread = 615352064, threadName = "MainThread" }
[19:41:57.017497335] (+0.000157445) archeepp lttng_python:event: { cpu_id = 1 }, { asctime = "2015-10-27 19:41:57,017", msg = "hello from logger2", logger_name = "hello34", funcName = "hello", lineno = 13, int_loglevel = 30, thread = 615352064, threadName = "MainThread" }
[19:41:57.117830244] (+0.100332909) archeepp lttng_python:event: { cpu_id = 1 }, { asctime = "2015-10-27 19:41:57,117", msg = "hello from logger", logger_name = "hello*", funcName = "hello", lineno = 12, int_loglevel = 30, thread = 615352064, threadName = "MainThread" }
[19:41:57.117955372] (+0.000125128) archeepp lttng_python:event: { cpu_id = 1 }, { asctime = "2015-10-27 19:41:57,117", msg = "hello from logger2", logger_name = "hello34", funcName = "hello", lineno = 13, int_loglevel = 30, thread = 615352064, threadName = "MainThread" }
[19:41:57.218462259] (+0.100506887) archeepp lttng_python:event: { cpu_id = 2 }, { asctime = "2015-10-27 19:41:57,218", msg = "hello from logger", logger_name = "hello*", funcName = "hello", lineno = 12, int_loglevel = 30, thread = 615352064, threadName = "MainThread" }
[19:41:57.218618033] (+0.000155774) archeepp lttng_python:event: { cpu_id = 2 }, { asctime = "2015-10-27 19:41:57,218", msg = "hello from logger2", logger_name = "hello34", funcName = "hello", lineno = 13, int_loglevel = 30, thread = 615352064, threadName = "MainThread" }

Also, lttng list session prints:

...

=== Domain: Python (logging) ===

Events (Logger name):
---------------------
    - hello* [enabled]

It is not clear in the output above whether * is part of the event name or not.

Suggested solution: support escape sequences to escape a legitimate * character. Then, we can enable the hello* event above like this:

lttng enable-event -p 'hello\*'

and an event with a name containing \ (double \ to bypass the shell first):

lttng enable-event -p 'some\\\\stuff'
Actions #1

Updated by Philippe Proulx about 9 years ago

  • Subject changed from It is not possible to enable/disable events with '*' in their names to It is not possible to only enable/disable events with '*' in their names
Actions

Also available in: Atom PDF