Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1514 (closed defect: fixed)

Opened 15 years ago

Last modified 14 years ago

Log hierarchy: parent level overwrites childs

Reported by: ShadowIce Assigned to: kris
Priority: normal Milestone: 0.99.9
Component: Tango Version: 0.99.7 Dominik
Keywords: Cc:

Description

If I create a child logger and after that the parent logger, creating the parent logger will reset the log level of the child to 0. But according to the Tango manual it should not matter in which order I create them.

Small example:

    Logger log1 = Log.lookup("test.one");
    log1.add(new AppendConsole());
    log1.level(Logger.Warn);
    log1.info("testing info...(not printed)");
    Logger log2 = Log.lookup("test");
    log2.add(new AppendConsole());
    log2.level(Logger.Warn);
    log1.info("this will be printed");
    log2.info("testing info again...(not printed)");

Attachments

Log.d.diff (221 bytes) - added by HeiHon on 11/30/09 17:02:06.
Diff against Log.d of tango-r5250 (made with winmerge)
log_ticket.d (1.5 kB) - added by HeiHon on 11/30/09 17:04:48.
Test for patched Log.d
Log_diff.d (221 bytes) - added by HeiHon on 11/30/09 17:07:19.
Second try for diff file (Log.d.diff seemed to be broken)

Change History

03/29/09 15:05:39 changed by larsivi

  • milestone changed from 0.99.8 to 0.99.9.

11/09/09 09:07:09 changed by kris

  • status changed from new to closed.
  • resolution set to fixed.

(In [5090]) fixes #1514 :: Log hierarchy: parent level overwrites child

thanks to ShadowIce?

11/30/09 17:00:34 changed by HeiHon

  • status changed from closed to reopened.
  • resolution deleted.

But this now prints, but shouldn't according to the manual:

Log.root.add(new AppendConsole());
Log.root.level(Log.root.Info);

Log.lookup("manual").trace("Logging like in the manual is now broken :-(");

This patch (against Log.d of tango-r5250) made it work again for me:

1062c1062
<                          propagate (l, curr);
---
>                          propagate (l, curr, true);

11/30/09 17:02:06 changed by HeiHon

  • attachment Log.d.diff added.

Diff against Log.d of tango-r5250 (made with winmerge)

11/30/09 17:04:48 changed by HeiHon

  • attachment log_ticket.d added.

Test for patched Log.d

11/30/09 17:07:19 changed by HeiHon

  • attachment Log_diff.d added.

Second try for diff file (Log.d.diff seemed to be broken)

12/01/09 18:30:19 changed by kris

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [5251]) fixes #1514 :: Log hierarchy: parent level overwrites children

Thanks to HeiHon? for the patch, and digging into the issue

12/01/09 18:32:05 changed by kris

new children inherit properties from the parent (level, etc), but injecting a parent does not (now) automatically reset the newly inherited children