The trace provided by Flex has the advantages of classification, but it is not easy to use.

Source: Internet
Author: User

The trace provided by Flex has the advantages of classification, but it is not easy to use.


<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX = ""
Initialize = "initializehandler ()">
<! [CDATA [
Import MX. Logging. log;
Import mx.logging.tar gets. TraceTarget;
Import MX. Logging. logeventlevel
Private VaR _ target: TraceTarget;
Private function initializehandler (): void
_ Target = new TraceTarget (); // creates a trace target
_ Target. includedate = true; // display date
_ Target. parse Detime = true; // display the trace time.
_ Target. Warn delevel = true; // display level (error, debug, info .....)
_ Target. includecategory = true; // display type
_ Target. Filters = ["net. nshen. Logging. *"]; // only displays trace information in the net. nshen. Logging package.

_ Target. Level = logeventlevel. info // only Info () information is displayed. Other debug () and error () information is not displayed...

Log. addtarget (_ target); // configure the target and fill it in the log.
Log. addtarget (

// Trace when the button is release
Private function sendtolog (): void
Log. getlogger ("net. nshen. Logging. mainclass"). Info ("Check the info information ~~ Haha only shows me ");
Log. getlogger ("com. Adobe. mainclass"). Info ("because it is not in the net. nshen. Logging package, I am not shown... 5555 ");
Log. getlogger ("net. nshen. Logging. mainclass"). debug ("because it is not info information, I am not shown... 555555555555 ");
// Two parameters (type and output information)
// Of course, you can not use the full name of the class, but it will be troublesome to filter, therefore, it is better to set the category to the full name of the class, such as the net. nshen. logging. mainclass
<Mx: button click = "sendtolog ()" label = "Log message"/>
</MX: Application>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.