How To Change/remove (Logging Logger) As The Default Try Catch Error Handling – Netbeans – Logger.getLogger()

How To Change/remove (Logging Logger) As The Default Try Catch Error Handling – Netbeans – Logger.getLogger()

How To Change/ remove (Logging Logger) As The Default Try Catch Error Handling – Netbeans – Logger.getLogger()
 
In Netbeans, go to menu option Tools -> Options -> Editor -> Hints (Tab) -> Make Sure Language Java is selected from the drop down mwenu -> in the tree click Plus icon on the left side of "Error Fixes" ->Choose "Surround with try-catch". -> Disable the checkbox: "Use java.util.logging.Logger"

This is the code before removing the default error handling (Java.util.logging.Logger)

/*
 * How To Remove/Change (Logging Logger) As The Default Try Catch Default Error Handling - Netbeans - Logger.getLogger()
 */
package loggerlogginggetlogger;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Genuine
 */
public class LoggerLoggingGetLogger {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
            // TODO code application logic here
            Connection conn = DriverManager.getConnection(null, null, null);
        } catch (SQLException ex) {
            Logger.getLogger(LoggerLoggingGetLogger.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
}

Step 1. In Netbeans, go to Tools
Step 2. Select Options

 How To Remove (Logging Logger) As The Default Try Catch Default Error Handling - Tools The Options
How To Remove (Logging Logger) As The Default Try Catch Default Error Handling – Tools The Options


Step 3. Choose Editor
Step 4. Hit Hints (Tab)
Step 5. Select Java language from the drop down mwenu
Step 6. In the tree click Plus icon on the left side of “Error Fixes”
Step 7. Choose “Surround with try-catch”.
Step 8. Disable the checkbox: “Use java.util.logging.Logger”

 How To Remove (Logging Logger) As The Default Try Catch Default Error Handling - Netbeans - Edit Hint
How To Remove (Logging Logger) As The Default Try Catch Default Error Handling – Netbeans – Edit Hint

After applying the above settings. Logger changes to printStackTrace(). As seen below:

/*
 * How To Remove/Change (Logging Logger) As The Default Try Catch Default Error Handling - Netbeans - Logger.getLogger()
 */
package loggerlogginggetlogger;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author Genuine
 */
public class LoggerLoggingGetLogger {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
            // TODO code application logic here
            Connection conn = DriverManager.getConnection(null, null, null);
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
    
}
READ MORE  C SHARP AND MYSQL DATABASE CRUD TUTORIAL 57 How To Refresh Datagridview Rows After Change In MySql

Leave a Reply

Your email address will not be published. Required fields are marked *