TiiToo / vegas

Automatically exported from code.google.com/p/vegas
1 stars 0 forks source link

Adding new targets causes old logs to repeat #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
To reproduce:
1. Log a message
2. Add a new target

When I add a new target for some reason the log messages that had been
added previously get repeated.  I'm guessing there is logic in place to
send old logs to the new target, but it looks like it isn't quite working
right.

Here's my test case:

---------------------------------------------
import vegas.logging.Log;
import vegas.logging.LogEventLevel;
import vegas.logging.ILogger;
import vegas.logging.targets.XPanelTarget;
import vegas.logging.targets.TraceTarget;

class TestMain {
  private static var LOG:ILogger;
  private var i:Number = 0;

  public static function main(rootMC:MovieClip):Void {
    Stage.align = "LT";
    Stage.scaleMode = "noScale";
    rootMC.stop();

    LOG = Log.getLogger("TestMain");

    trace("--1");
    LOG.info("1");

    var target:XPanelTarget = new XPanelTarget("Test");
    target.includeLevel = true;
    target.includeTime = true;
    target.includeCategory = true;
    target.filters = ["*"];
    target.level = LogEventLevel.ALL;

    Log.addTarget(target);

    trace("--2");
    LOG.info("2")

    var traceTarget:TraceTarget = new TraceTarget();
    traceTarget.includeLevel = true;
    traceTarget.includeTime = true;
    traceTarget.includeCategory = true;
    traceTarget.filters = ["*"];
    traceTarget.level = LogEventLevel.ALL;

    Log.addTarget(traceTarget);

    trace("--3");
    LOG.info("3")

    var alconTarget:AlconTarget = new AlconTarget();
    alconTarget.includeLevel = true;
    alconTarget.includeTime = true;
    alconTarget.includeCategory = true;
    alconTarget.filters = ["*"];
    alconTarget.level = LogEventLevel.ALL;

    Log.addTarget(alconTarget);

    trace("--4");
    LOG.info("4")

    var t:TestMain = new TestMain(rootMC);
  }

  function TestMain(rootMC:MovieClip) {
    initMovie();
  }

  function initMovie():Void {
    LOG.info("initMovie");

    LOG.debug("Debug");
    LOG.error("Error");
    LOG.fatal("Fatal");
    LOG.info("Info");
    LOG.warn("Warn");
    LOG.info("Test {0} formatting {1} of {2} doom", true, i, "testy");
  }
}
---------------------------------------------

When I run this (though the FlashIDE so the XPanel target works) I get the
following in the Flash output window:

---------------------------------------------
--1
XPanelTarget
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 1
--2
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 2
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 1
11:25:42 [INFO] TestMain 1
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 1
11:25:42 [INFO] TestMain 1
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 2
11:25:42 [INFO] TestMain 2
--3
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 3
11:25:42 [INFO] TestMain 3
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 1
11:25:42 [INFO] TestMain 1
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 1
11:25:42 [INFO] TestMain 1
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 2
11:25:42 [INFO] TestMain 2
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 1
11:25:42 [INFO] TestMain 1
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 1
11:25:42 [INFO] TestMain 1
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 2
11:25:42 [INFO] TestMain 2
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 3
11:25:42 [INFO] TestMain 3
--4
XPanelTarget logging (4) 11:25:42 [INFO] TestMain 4
11:25:42 [INFO] TestMain 4
XPanelTarget logging (4) 11:25:42 [INFO] TestMain initMovie
11:25:42 [INFO] TestMain initMovie
XPanelTarget logging (2) 11:25:42 [DEBUG] TestMain Debug
11:25:42 [DEBUG] TestMain Debug
XPanelTarget logging (8) 11:25:42 [ERROR] TestMain Error
11:25:42 [ERROR] TestMain Error
XPanelTarget logging (1000) 11:25:42 [FATAL] TestMain Fatal
11:25:42 [FATAL] TestMain Fatal
XPanelTarget logging (4) 11:25:42 [INFO] TestMain Info
11:25:42 [INFO] TestMain Info
XPanelTarget logging (6) 11:25:42 [WARN] TestMain Warn
11:25:42 [WARN] TestMain Warn
XPanelTarget logging (4) 11:25:42 [INFO] TestMain Test true formatting 0 of
testy doom
11:25:42 [INFO] TestMain Test true formatting 0 of testy doom
---------------------------------------------

In the XPanel window I get:

---------------------------------------------
11:25:42 AM [0:00:00.047] [Information] 11:25:42 [INFO] TestMain 1
11:25:42 AM [0:00:00.048] [Information] 11:25:42 [INFO] TestMain 2
11:25:42 AM [0:00:00.050] [Information] 11:25:42 [INFO] TestMain 1
11:25:43 AM [0:00:00.051] [Information] 11:25:42 [INFO] TestMain 1
11:25:43 AM [0:00:00.052] [Information] 11:25:42 [INFO] TestMain 2
11:25:43 AM [0:00:00.054] [Information] 11:25:42 [INFO] TestMain 3
11:25:43 AM [0:00:00.056] [Information] 11:25:42 [INFO] TestMain 1
11:25:43 AM [0:00:00.058] [Information] 11:25:42 [INFO] TestMain 1
11:25:43 AM [0:00:00.063] [Information] 11:25:42 [INFO] TestMain 2
11:25:43 AM [0:00:00.074] [Information] 11:25:42 [INFO] TestMain 1
11:25:43 AM [0:00:00.076] [Information] 11:25:42 [INFO] TestMain 1
11:25:43 AM [0:00:00.081] [Information] 11:25:42 [INFO] TestMain 2
11:25:43 AM [0:00:00.086] [Information] 11:25:42 [INFO] TestMain 3
11:25:43 AM [0:00:00.088] [Information] 11:25:42 [INFO] TestMain 4
11:25:43 AM [0:00:00.090] [Information] 11:25:42 [INFO] TestMain initMovie
11:25:43 AM [0:00:00.095] [Debug] 11:25:42 [DEBUG] TestMain Debug
11:25:43 AM [0:00:00.097] [Error] 11:25:42 [ERROR] TestMain Error
11:25:43 AM [0:00:00.099] [Fatal] 11:25:42 [FATAL] TestMain Fatal
11:25:43 AM [0:00:00.101] [Information] 11:25:42 [INFO] TestMain Info
11:25:43 AM [0:00:00.103] [Warning] 11:25:42 [WARN] TestMain Warn
11:25:43 AM [0:00:00.107] [Information] 11:25:42 [INFO] TestMain Test true
formatting 0 of testy doom
---------------------------------------------

And in the Alcon window I get:

---------------------------------------------
[INFO] 11:25:42 [INFO] TestMain 1
 [INFO] 11:25:42 [INFO] TestMain 1
 [INFO] 11:25:42 [INFO] TestMain 2
 [INFO] 11:25:42 [INFO] TestMain 1
 [INFO] 11:25:42 [INFO] TestMain 1
 [INFO] 11:25:42 [INFO] TestMain 2
 [INFO] 11:25:42 [INFO] TestMain 3
 [INFO] 11:25:42 [INFO] TestMain 4
 [INFO] 11:25:42 [INFO] TestMain initMovie
[DEBUG] 11:25:42 [DEBUG] TestMain Debug
[ERROR] 11:25:42 [ERROR] TestMain Error
[FATAL] 11:25:42 [FATAL] TestMain Fatal
 [INFO] 11:25:42 [INFO] TestMain Info
 [WARN] 11:25:42 [WARN] TestMain Warn
 [INFO] 11:25:42 [INFO] TestMain Test true formatting 0 of testy doom
---------------------------------------------

Original issue reported on code.google.com by aherr...@gmail.com on 26 Jan 2007 at 4:29

GoogleCodeExporter commented 9 years ago
Ok thanks i test and try to fix this bug this week end :)

Original comment by ekamel...@gmail.com on 26 Jan 2007 at 4:40

GoogleCodeExporter commented 9 years ago

Original comment by ekamel...@gmail.com on 7 Sep 2007 at 7:45

GoogleCodeExporter commented 9 years ago

Original comment by ekamel...@gmail.com on 12 Sep 2007 at 9:08

GoogleCodeExporter commented 9 years ago

Original comment by ekamel...@gmail.com on 12 Sep 2007 at 9:09

GoogleCodeExporter commented 9 years ago

Original comment by ekamel...@gmail.com on 12 Sep 2007 at 9:09