Java error log
Java error log is a error that arises due to internal error. A error logger is simple an object that is used to show an error log message for a specifice system and component used in an application.
In this Tutorial we want to describe you a code that show a java error log, for this we have a Class name'javaerrorlog' .Inside the class name we have a private static variable logger that returns you a logger name according to name of the parameter passed in it by calling a method name get Logger(). Inside the main static method ( ) . The class file handler is inherited from java.util.logging.The function of file handler is to either write in the specified file used in your programming. The file handler write to a specified file i.e. log.txt and store in a object of class File Handler name 'handler'.
Now understand list of method used in code-
|add Handler||This is used to add a handler in order to receive logging message.|
|set Level||This method returns you or set the level for a globally registered method. In brief you can say this is used to set the log level message specify the message logged by the specified user.|
This method return you an info message to you. The code consists of try-catch block to check the exception arises in code. for every subsequent try block there is a catch block that consists of a method name.
|log||This method return you log a log record.|
code to understand java log error