Menu

#27 Logging API : Some problems

0.9
closed
None
5
2005-06-13
2005-06-13
eRom
No

Hi,

Reading class documentation and your website article, I
see logging declaration like this :

--------------------------------------------------------------
var logger : Logger = new SimpleLogger();
logger.addHandler( new TraceHandler() );
LogManager.setLogger(logger);
var myLogger:Logger =
LogManager.getLogger("org.mydomain.MyClass");
myLogger.info("This is an informative log message.");
--------------------------------------------------------------

But Logger interface don't define addHandler method, so
we have an error during compilation (MM compilo and MTASC).

Moreever, there is a small MTASC error when using :
--------------------------------------------------------------
LogManager.setLoggerRepository (repository);
--------------------------------------------------------------

MTASC Error message :
"Logger.as lines 62 - 179 : type error class name
mistake : should be org.as2lib.env.log.Logger "

Bye.

Discussion

  • eRom

    eRom - 2005-06-13
    • assigned_to: nobody --> simonwacker
     
  • eRom

    eRom - 2005-06-13

    Logged In: YES
    user_id=1196309

    Sorry for my second point (MTASC error)
    --------------------------------------------------------------
    LogManager.setLoggerRepository (repository);
    --------------------------------------------------------------

    Error exist when I declare my import setting with .* , for
    exemple
    --------------------------------------------------------------
    import org.as2lib.env.log.*;
    import org.as2lib.env.log.logger.*;
    --------------------------------------------------------------
    If I do that, mtasc find an error with class name defnition,
    I think there is conflict between class name Logger and
    package name logger.
    So we don't have to use import ".*" when using logging API.
    is it right ?

    Thanks. ;)

     
  • Simon Wacker

    Simon Wacker - 2005-06-13

    Logged In: YES
    user_id=922171

    1. On which page is the usage like this? I just flipped through
    the logger tutorial and took a look at a few class
    documentations but could not find the kind of code you
    posted above.
    The variable logger must of course be typed to SimpleLogger
    or ConfigurableLogger (so this is an error in the example).

    2. I experienced the same problem, but I do not think that this
    has to do with the package logger and the class Logger
    (because I did not experience this with map and Map). But I
    am not that experienced with mtasc so you should track the
    problem down and post it on the mtasc mailing list.
    My advice is to just not use wildcards in imports. ;) It is much
    more easy to find out in which package a class is if it is
    imported directly.

    Greetings,
    Simon

     
  • Simon Wacker

    Simon Wacker - 2005-06-13

    Logged In: YES
    user_id=922171

    Forgot to close this "bug?".

     
  • Simon Wacker

    Simon Wacker - 2005-06-13
    • status: open --> closed
     
  • eRom

    eRom - 2005-06-13

    Logged In: YES
    user_id=1196309

    This usage is found in LogManager.as (line 53) in
    documentation section ;)

    I agree with you when you say "It is much
    more easy to find out in which package a class is if it is
    imported directly", but can be very long to do when we
    import many many classes..but cleaner, ok ^^
    (I post to mtasc list to report this small problem).

    Thanks and bye.

     
  • Simon Wacker

    Simon Wacker - 2005-06-13

    Logged In: YES
    user_id=922171

    Oh, LogManager. Did not look at this class. Well, then, I'll fix
    the docu.
    Imports should be managed by the IDE (as the Eclipse Java
    Plugin does). ;)

    Thanks,
    Simon

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.