Java exceptions, configuring log4j

Source: Internet
Author: User
Tags finally block throwable log4j

Attention:

All exceptions in 1.Java are objects generated by subclasses of the Throwable class, and all exception classes are subclasses of subclasses or subclasses of the Throwable class. The Throwable class is a direct subclass of the object class, and the error class and the exception class are the two direct subclasses of the Throwable class.

Error class

Java.lang.Error

The error class typically refers to a virtual machine-related

Exception Exception class

The 2.java.lang.exception class is the direct or indirect parent class for all exceptions in Java

  

Exception handling in Java is implemented by 5 keywords Try,catch,finally,throw,throws

The difference between throw and throws:

Throw is a statement that throws an exception, and throws is a declaration that an exception can occur

Exception capture Syntax:

        Try {            // put code that could be faulted here        catch  (Exception e) {            // If an exception occurs in the try block then it is caught by the catch        } finally {            // Whether or not an exception occurs finally            executes // if System.exit appears in a try or catch ( 0) Finally block will not execute because the Java Virtual machine has been closed        }
    

Multi-Path Exception capture syntax:

        //Multi-path anomaly capture        Try {            //put code that might be wrong here}Catch(NullPointerException e) {//Multi-Path exception capturing subclass exception in front}Catch(Exception e) {//Parent class exception in the back}finally{            //Whether or not an exception occurs, the finally will execute//if the System.exit (0) Finally block appears in a try or catch, it will not execute because the Java virtual machine has been shut down}

Multi-Path Exception capture Note: The subclass exception is before the parent class exception

  

Configure log4j Picture Tutorial (no tutorial):

==========================================================================

The following is a exception directly known subclass Aclnotfoundexception, Activationexception, alreadyboundexception

ApplicationException, Awtexception, backingstoreexception

Badattributevalueexpexception, Badbinaryopvalueexpexception, badlocationexception

Badstringoperationexception, Brokenbarrierexception, Certificateexception, classnotfoundexception

Clonenotsupportedexception, Dataformatexception, Datatypeconfigurationexception, DestroyFailedException

Executionexception, Expandvetoexception, Fontformatexception, Generalsecurityexception, GSSException

Illegalaccessexception, Illegalclassformatexception, Instantiationexception, Interruptedexception, Introspectionexception

Invalidapplicationexception, Invalidmididataexception, Invalidpreferencesformatexception, Invalidtargetobjecttypeexception

InvocationTargetException, IOException, Jmexception, Lastownerexception, Lineunavailableexception, Midiunavailableexception

Mimetypeparseexception, Namingexception, Noninvertibletransformexception, Nosuchfieldexception, Nosuchmethodexception

Notboundexception, Notownerexception, ParseException, Parserconfigurationexception, PrinterException, Printexception

Privilegedactionexception, Propertyvetoexception, Refreshfailedexception, Remarshalexception, RuntimeException, Saxexception

Servernotactiveexception, SQLException, TimeoutException, Toomanylistenersexception, Transformerexception, Unmodifiableclassexception

Unsupportedaudiofileexception, Unsupportedcallbackexception, Unsupportedflavorexception, Unsupportedlookandfeelexception

URISyntaxException, Userexception, Xaexception, Xmlparseexception, XPathException

==================================================================================================

   

    

Java exceptions, configuring log4j

Related Article

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: info-contact@alibabacloud.com 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.