You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Joel Knighton (JIRA)" <ji...@apache.org> on 2017/11/18 00:32:00 UTC

[jira] [Updated] (CASSANDRA-14059) Root logging formatter broken in dtests

     [ https://issues.apache.org/jira/browse/CASSANDRA-14059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joel Knighton updated CASSANDRA-14059:
--------------------------------------
    Status: Patch Available  (was: Open)

Patch here: [https://github.com/jkni/cassandra-dtest/commit/91e860da6b5959df02d14cc56b0d5c09a2926a83]. This removes the field from the formatter and instead concatenates it to the message inside dtest logging functions. It also changes the way we construct the CURRENT_TEST global. In my testing, the test id already contained the method name, so method names were duplicated in log output.

There may be a convincing argument to removing the dtest.log logger configuration entirely. It appears to have been missing for some time without anyone noticing. For now, I introduced a behavior that's close to the original intention of the dtest.log, as far as I can tell.

> Root logging formatter broken in dtests
> ---------------------------------------
>
>                 Key: CASSANDRA-14059
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14059
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Testing
>            Reporter: Joel Knighton
>            Assignee: Joel Knighton
>            Priority: Minor
>
> Since the ccm dependency in dtest was bumped to {{3.1.0}} in {{7cc06a086f89ed76499837558ff263d84337acba}}, when dtests are run with --nologcapture, errors of the following form are printed:
> {code}
> Traceback (most recent call last):
>   File "/usr/lib64/python2.7/logging/__init__.py", line 861, in emit
>     msg = self.format(record)
>   File "/usr/lib64/python2.7/logging/__init__.py", line 734, in format
>     return fmt.format(record)
>   File "/usr/lib64/python2.7/logging/__init__.py", line 469, in format
>     s = self._fmt % record.__dict__
> KeyError: 'current_test'
> Logged from file dtest.py, line 485
> {code}
> This is because CCM no longer installs a basic root logger configuration, which is probably a more correct behavior than what it did prior to this change. Now, dtest installs its own basic root logger configuration which writes to 'dtest.log' using the formatter {{'%(asctime)s,%(msecs)d %(name)s %(current_test)s %(levelname)s %(message)s'}}. This means that anything logging a message must provide the current_test key in its extras map. The dtest {{debug}} and {{warning}} functions do this, but logging from dependencies doesn't, producing these {{KeyError}}s. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org